Your browser (Internet Explorer 6) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.
X

[SOLVED] Mod-Rewrite is not enabled - Phalcon

I ran into this funny error and almost got me pulling my hair. My development branch has been working so fine until I fixed a merge conflict on a branch and the whole story began.

Looking for so long into this probelm I realised that looking for how to enable your mod_rewrite is not the issue for me. The real issue is with the htaccess file. My virtual host configuration is pointing to the project root and htaccess file is not there.

In Phalcon, there are two htaccess files. One resides in the public folder and the other in the project folder. Below is a sample project structure

+----Project
   +----app
   +----public
           +----.htaccess
           +...
   +----.htaccess

.htaccess on project level

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>

.htaccess in the public folder

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
</IfModule>

 

Check where your virtual host configuration is pointing to and make sure the htaccess file is there.

Hope this gets someone out of trouble.


comments powered by Disqus