Nginx – Convert a RewriteRule from nginx to apache

apache-2.2nginxrewrite

i want to convert a nginx rewriterule to a htaccess rewrite rule.

The nginx one is the following:

rewrite ^/(.*)$ /index.php?$1 last;

I tried it with:

RewriteEngine On
RewriteRule ^/(.*)$ /index.php?$1

… but i doesnt work correctly. (No Page found)

It would be nice if anyone can help me.

edit:

I changed the suggestion from "Logic Wreck" a little bit (because it was not possible to change the index.php to another):

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]

and it works great :).

Best Answer

Try these:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Related Topic