rewrite rules

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

rewrite rules

Tomasz Pajor
Hello,

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

Can anybody point me out how should this rules look like for nginx,
thanks in advance!

--
Best regards
Tomasz Pajor

Reply | Threaded
Open this post in threaded view
|

Re: rewrite rules

Cliff Wells
On Mon, 2009-06-01 at 07:30 +0200, Tomasz Pajor wrote:

> Hello,
>
> RewriteEngine On
> RewriteCond %{REQUEST_FILENAME} -s [OR]
> RewriteCond %{REQUEST_FILENAME} -l [OR]
> RewriteCond %{REQUEST_FILENAME} -d
> RewriteRule ^.*$ - [NC,L]
> RewriteRule ^.*$ index.php [NC,L]
>
> Can anybody point me out how should this rules look like for nginx,
> thanks in advance!

I don't think you'll need any rewrites in Nginx.  It appears that the
above basically says, "if the file exists, serve it, otherwise hand the
request to PHP".  In Nginx that equates to:

location / {
    root /path/to/docroot;
    expires 30d;
    index index.php;
    error_page 404 = index.php;
    log_not_found off;
}

location \.php$ {
    # ... usual PHP FastCGI stuff
}

Regards,
Cliff