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'm new to Nginx, how can I rewrite this mod_rewrite, so that will work in Nginx?

RewriteEngine On
RewriteRule (.*) index.php

I tried this, but it didn't work.

location / {

    (...)

    reqrite (.*) /index.php last;

}

Thanks!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Try:

location / {
    rewrite ^(.*)$ /index.php break;
}
share|improve this answer
    
Still '500 Internal Server Error'. :-( –  Laura Brown Jan 24 '11 at 0:45
    
try with break. –  osdyng Jan 24 '11 at 2:49
    
It works, thanks! –  Laura Brown Jan 24 '11 at 7:23
    
when i try adding this it outputs my php source into the browser ! ... –  Hayden Thring Jan 17 '13 at 10:53
    
@HaydenThring That's probably because you are not executing the PHP, you also will need to have it configured to actually execute the PHP. –  Bjorn Tipling Oct 4 '13 at 19:50

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.