rewriterules

AMP Admin admin at ampprod.com
Fri Apr 24 20:21:43 MSD 2009


Sorry, I forgot a line:
RewriteCond %{REQUEST_URI} !(index\.php|\.css) [NC]
RewriteRule ^(archive|sitemap)/(.*)$ $1/index.php/$2 [QSA,L]

-----Original Message-----
From: owner-nginx at sysoev.ru [mailto:owner-nginx at sysoev.ru] On Behalf Of Igor
Sysoev
Sent: Friday, April 24, 2009 10:51 AM
To: nginx at sysoev.ru
Subject: Re: rewriterules

On Fri, Apr 24, 2009 at 08:44:36AM -0500, AMP Admin wrote:

>  Sorry for a simple question but I'm just not that good at regex and nginx
> yet.  Can someone help me convert the .htaccess rewrite to nginx?
> 
> RewriteRule ^([a-z0-9_\-]*-(f|all)[0-9]+(p[0-9]+|/index[0-9]*)?\.html)$
> page.php/$1 [QSA,L]
> RewriteRule ^([a-z0-9_\-]*-(t|p)[0-9]+(p[0-9]+|/index[0-9]*)?\.html)$
> page.php/$1 [QSA,L]
> RewriteCond %{REQUEST_URI} !(index\.php|\.css) [NC]

It seems your rules are not complete. What is after

    RewriteCond %{REQUEST_URI} !(index\.php|\.css) [NC]

?

The first two rules:

   location / {
       rewrite  ^/([\w\-]*-(f|all)\d+(p\d+|/index\d*)?\.html)$ /page.php/$1;

       rewrite  ^/([\w\-]*-(t|p)\d+(p\d+|/index\d*)?\.html)$ /page.php/$1; 

       ...
   }


-- 
Igor Sysoev
http://sysoev.ru/en/






More information about the nginx mailing list