Rewrite rule for nginx from Apache

Brandon Amaro omega13a at fedtrek.com
Fri May 13 04:19:28 MSD 2011


using http://www.anilcetin.com/convert-apache-htaccess-to-nginx/ , I got 
this:

#ignored: condition 0
#ignored: "-" thing used or unknown variable in regex/rew
if (-e $request_filename){
     set $rule_1 1;
}
if ($request_filename ~ "-l"){
     set $rule_1 1;
}
if (-d $request_filename){
     set $rule_1 1;
}
if ($rule_1 = "1"){
#ignored: "-" thing used or unknown variable in regex/rew
}
     rewrite ^/index(.*)$ /;
     rewrite ^/chat/.* /;
     rewrite ^/Songs(.*)$ /;
     rewrite ^/Jokes(.*)$ /;
     rewrite ^/Ash3ar(.*)$ /;
     rewrite ^/iraq/.* /;
     rewrite ^/Song/.* /;
     rewrite ^/Joke/.* /;
     rewrite ^/Poem/.* /;
     rewrite ^/link/.* /;
     rewrite ^/search/.* /;
     rewrite ^/adv-conditions(.*)$ /;
     rewrite ^/adv-payments(.*)$ /;
if (-e $request_filename){
     set $rule_15 1;
}
if ($request_filename ~ "-l"){
     set $rule_15 1;
}
if (-d $request_filename){
     set $rule_15 1;
}
if ($rule_15 = "1"){
#ignored: "-" thing used or unknown variable in regex/rew
}
     rewrite ^/(?:(.*?)(?:/|$))(.*|$)$ /$1.php?r=$2;

-- 
omega13a
Owner and Founder of UFT
http://www.fedtrek.com


On 05/12/2011 04:59 PM, the_traveller wrote:
> <IfModule mod_rewrite.c>
> RewriteEngine on
>
> # If you are having problems or are using VirtualDocumentRoot, uncomment
> this line and set it to your  directory.
> # RewriteBase/maindir/
> RewriteOptions MaxRedirects=30
> RewriteCond %{ENV:REDIRECT_STATUS} 200
> RewriteRule .* - [L]
>
>
> RewriteCond %{REQUEST_FILENAME} -s [OR]
> RewriteCond %{REQUEST_FILENAME} -l [OR]
> RewriteCond %{REQUEST_FILENAME} -d
>
> RewriteRule ^.*$ - [NC,L]
>
> RewriteRule ^index(.*)$                                      index.php
> [QSA]
> RewriteRule ^chat/.*                                         pages.php
> [QSA]
> RewriteRule ^Songs(.*)$
> showcat.php?g=2 [QSA]
> RewriteRule ^Jokes(.*)$
> showcat.php?g=3 [QSA]
> RewriteRule ^Ash3ar(.*)$
> showcat.php?g=4 [QSA]
> RewriteRule ^iraq/.*                                        showcat.php
>     [QSA]
> RewriteRule ^Song/.*                                         sounds.php
>      [QSA]
> RewriteRule ^Joke/.*                                         jokes.php
>      [QSA]
> RewriteRule ^Poem/.*                                         poems.php
>      [QSA]
> RewriteRule ^link/.*                                         advs.php
>      [QSA]
> RewriteRule ^search/.*                                       search.php
>      [QSA]
> RewriteRule ^adv-conditions(.*)$
> ad.php?go=conditions      [NC]
> RewriteRule ^adv-payments(.*)$
> ad.php?go=payments      [NC]
>
> RewriteCond %{REQUEST_FILENAME} -s [OR]
> RewriteCond %{REQUEST_FILENAME} -l [OR]
> RewriteCond %{REQUEST_FILENAME} -d
>
> RewriteRule ^.*$ - [NC,L]
> RewriteRule ^(?:(.*?)(?:/|$))(.*|$)$ $1.php?r=$2 [QSA]
>
>
> </IfModule>
>
>
> <IfModule mod_security.c>
>     SecFilterEngine Off
>     SecFilterScanPOST Off
> </IfModule>
>
> <IfModule mod_gzip.c>
> mod_gzip_on No
> </IfModule>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20110512/51a7e00e/attachment-0001.html>


More information about the nginx mailing list