rewriterules

Igor Sysoev is at rambler-co.ru
Fri Apr 24 19:50:51 MSD 2009


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