Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 :).

share|improve this question
    
append a last|L flag, then try again. –  quanta Aug 22 '12 at 14:00

1 Answer 1

Try these:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.