Rewrite rule for nginx from Apache

Robert Gabriel lists at
Thu Nov 19 22:17:23 MSK 2009

Hey, thanks for the help, but Im not getting how do you actually do it.

For example I got a new rewrite rule from Apache

   RewriteOptions MaxRedirects=1
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule ^([a-zA-Z0-9_-]+)$ redirect.php?alias=$1 [L]

and did this:

  location ~ "^/(?<alias>([a-zA-Z0-9_-]))$" {
          root $site_root;
            fastcgi_pass unix:/var/tmp/php-fastcgi.socket;
            fastcgi_param SCRIPT_NAME     /redirect.php;
            fastcgi_param SCRIPT_FILENAME $site_root/redirect.php;
            fastcgi_param QUERY_STRING    alias=$alias;

and it doesn't work. Do you know why?
Posted via

More information about the nginx mailing list