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

Mod-Rewrite is not enabled

Hi everyone,

I encountered error "Mod-Rewrite is not enabled. Please enable rewrite module on your web server to continue" when I navigate to newly created Phalcon project. I tried to change nginx configuration file but it does not work. Please help me to fix this problem. Thanks.

My server settings: 1- Ubuntu 12.04, Nginx -PHP5-FPM, MySQL. 2- root folder /var/www/cuong/www. I installed and run WordPress, PHPMyAdmin successfully on sub folder. /var/www/cuong/www -----------------------------/wordpress <- run ok -----------------------------/phpmyadmin <- run ok -----------------------------/store <- Phacon project generated by Dev-Tools. Error "Mod-Rewrite is not enabled...."

Below is detail of my Nginx configuration file:

erver { listen 80; ## listen for ipv4; this line is default and implied

    root /var/www/cuong/www;
    index index.php index.html index.htm;

    server_name falcon;
    try_files $uri $uri/ @rewrite;

    location @rewrite {
            rewrite ^/(.*)$ /index.php?_url=/$1;
    }

    location ~ \.php$ {
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            fastcgi_split_path_info       ^(.+\.php)(/.+)$;
            fastcgi_param PATH_INFO       $fastcgi_path_info;
            #fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
    }

}

Hi I tried your config but it does not help. What I want is to make WordPress, PHPMyAdmin and Phalcon co exists in a virtual host. Let say https://www.example.com/wordpress https://www.example.com/phpmyadmin https://www.example.com/phalcon

Folder layout look like this /var/www/cuong/www/wordpress /var/www/cuong/www/phpmyadmin /var/www/cuong/www/phalcon

Please help to sample nginx configuration you have configured phalcon app that way successfully.

I know this is a little late, but I'll bump this anyway since other people may have this issue. Your directory structure looks wrong to me. I'm going to go out on a limb here and assume that phalcon is your project directory and not the public directory. You should have your path pointing to the public directory.

Bump!

For Apache users with the same issue, make sure you've got the rewrite module loaded,

a2enmod rewrite

..and that AllowOverride is set to "All" in the apache conf.

<Directory "/var/www/">
  ...
  AllowOverride All
</Directory>

Don't forget to restart apache.