Rewrite rule for nginx from Apache

Igor Sysoev igor at sysoev.ru
Sun May 15 16:50:04 MSD 2011


On Sat, May 14, 2011 at 05:38:49PM -0400, the_traveller wrote:
> ;(

Rewrite rules are not configuration means. They are primitive programming
language that is too hard to understand. For example, these

RewriteRule ^chat/.*    pages.php [QSA]
RewriteRule ^Songs(.*)$ showcat.php?g=2 [QSA]

may be translated to

location /maindir/chat/ {
    fastcgi_pass   ...
    fastcgi_param  SCRIPT_FILENAME   /path/to/script/pages.php;
    fastcgi_param  QUERY_STRING      $args;
    ...
}

location /maindir/Songs/ {
    fastcgi_pass   ...
    fastcgi_param  SCRIPT_FILENAME   /path/to/script/showcat.php;
    fastcgi_param  QUERY_STRING      g=2$is_args$args;
    ...
}


-- 
Igor Sysoev



More information about the nginx mailing list