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

I have the below .htaccess file in apache that redirects all request to app/index.php with or without a GET parameter. I just installed NGINX and my application won't run. Can anyone assist in replicating same functionality in NGINX? Thanks.

RewriteEngine on    

Options -Indexes

RewriteRule    ^$ app/ [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ app/index.php?url=$1 [QSA,L]
share|improve this question

migrated from stackoverflow.com Jul 16 '12 at 7:27

This question came from our site for professional and enthusiast programmers.

1 Answer 1

Use the rewrite module. Something like this should do it:

location / {
  autoindex off;

  rewrite ^/$ app/ last;
  if (!-e $request_filename) {
    rewrite ^/(.*)$ app/index.php?url=$1;
share|improve this answer

Your Answer


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.