We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Help,phalcon How can we don't use the rewrite?

I don't use the rewrite,phalcon How to configure



14.7k

Hi, Can you explain a bit further please? You can't set up the Apache rewrite module or is it something else?

Also, check https://docs.phalcon.io/en/latest/reference/install.html

Steven

Thank you for your answer. I want to say is I do not want to use rewrite. Do not use rewrite to do development .



14.7k

Well then I guess you'll have to implement a router in PHP yourself.

The tricky point will be that you need to direct any URL to a same PHP file where you can then handle the URL rewriting/re-interpretation.

What you can do is set the php.ini variable auto_prepend_file (https://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file) so any request for a PHP file will first execute the prepended file. That's where you can then parse $_SERVER['REQUEST_URI'] and reroute the requests to the Phalcon app controllers accordingly.

But I'm a bit short on the Phalcon inside workings to explain you how you can then pass your request variables on to the framework engine... maybe someone else can help you with that.

Otherwise, this blog post may bring you a but further down your path: https://akrabat.com/zend-framework/zend-framework-urls-without-mod_rewrite/

Good luck, Steven

P.S.: What's the point of not using rewrite in development? If you can use it in production, then I suggest you use it in development as well.



14.7k

Thanks for pointing us to this URL, nice to know!

Steven