Convert Apache .htaccess rewrite to nginx

nngin nginx-forum at nginx.us
Tue Jun 23 15:21:13 UTC 2015


Hello,
I am new to nginx and I am having trouble converting htaccess rewrite to
nginx rewrite. Please help me convert the following mod_rewrites with a
brief explanation. And should I put the nginx rewrite back into the
.htaccess file or is there a designated config file to put the nginx
location blocks?

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,259810,259810#msg-259810



More information about the nginx mailing list