How to write this rewrite???

Jim Ohlstein jim at ohlste.in
Fri Jul 24 20:04:53 MSD 2009


armiswip wrote:
> Hi, guys and Igor Sysoev!
>
> This is Apache's format, how to write in nginx???  Thanks a lot.
>
>
> Order allow,deny
> Deny from All
> Satisfy All
>
>
> php_value session.use_cookies 0
> php_value session.use_trans_sid 1
> php_value arg_separator.output "&"
>
> php_value magic_quotes_gpc 0
> php_value magic_quotes_runtime 0
> php_value magic_quotes_sybase 0
>
> php_flag register_argc_argv Off
>
> php_flag register_globals Off
>
> php_flag display_errors Off
> php_value error_reporting 0
> php_flag log_errors Off
>
> Options -Indexes
> AddDefaultCharset UTF-8
> php_value default_charset UTF-8
>
> RewriteEngine on
> RewriteRule ^(*)/?$ index.php?ver=$1 
> RewriteRule ^menu/(*)/([0-9]*)/(*)/(*)/?$ menu.php?ver=1$&nickname=$2&password=$3&action=$4 
> RewriteRule ^go/(*)/([0-9]*)/(*)/?$ go.php?ver=$1&nickname=$2&password=$3 
> RewriteRule ^kto/(*)/?$ kto.php?ver=$1 
> RewriteRule ^menu/(*)/(*)/?$ menu.php?ver=$1&nocache=$2 
> RewriteRule ^menu/(*)/?$ menu.php?ver=$1 
> RewriteRule ^dobav/(*)/?$ dobav.php?ver=$1 
> RewriteRule ^dobavst/(*)/?$ dobavst.php?ver=$1 
>
> RewriteRule ^dobavpriv/(*)/?$ dobavpriv.php?ver=$1 
>
> RewriteRule ^dobavs/(*)/?$ dobavs.php?ver=$1 
> RewriteRule ^lichvstr/(*)/?$ lichvstr.php?ver=$1 
> RewriteRule ^dobav/(*)/(*)/?$ dobav.php?ver=$1&case=$2 
> RewriteRule ^dobavst/(*)/(*)/?$ dobavst.php?ver=$1&case=$2 
>
> RewriteRule ^dobavpriv/(*)/(*)/?$ dobavpriv.php?ver=$1&case=$2 
>
> RewriteRule ^dobavs/(*)/(*)/?$ dobavs.php?ver=$1&case=$2 
> RewriteRule ^lichvstr/(*)/(*)/?$ lichvstr.php?ver=$1&case=$2 
> RewriteRule ^news/(*)/(*)/?$ news.php?ver=$1&nid=$2 
> RewriteRule ^obyav/(*)/(*)/?$ obyav.php?ver=$1&nid=$2 
> RewriteRule ^art/(*)/(*)/?$ art.php?ver=$1&nomer=$2 
> RewriteRule ^arts/(*)/(*)/?$ arts.php?ver=$1&nomer=$2 
> RewriteRule ^artv/(*)/(*)/?$ artv.php?ver=$1&nomer=$2 
> RewriteRule ^info/(*)/(*)/(*)/?$ info.php?uid=$1&ver=$2&act=$3 
> RewriteRule ^search/(*)/(*)/?$ search.php?ref=$1&ver=$2 
> RewriteRule ^vstrechi/(*)/(*)/(*)/?$ vstrechi.php?ver=$1&case=$2&nomer=$3 
> RewriteRule ^gazeta/(*)/(*)/(*)/?$ gazeta.php?ver=$1&case=$2&nomer=$3 
> RewriteRule ^stixi/(*)/(*)/(*)/?$ stixi.php?ver=$1&case=$2&nomer=$3 
>
>
>
> RewriteRule ^history/(*)/(*)/(*)/?$ history.php?ver=$1&rid=$2&nocache=$3 
> RewriteRule ^history/(*)/(*)/(*)/(*)/?$ history.php?ver=$1&rid=$2&s=$3&nocache=$4 
> RewriteRule ^room/(*)/(*)/(*)/(*)/(*)/?$ room.php?ver=$1&rid=$2&z=$3&msg=$4&nocache=$5 
> RewriteRule ^letters/(*)/(*)/?$ letters.php?ver=$1&mod=$2 
> RewriteRule ^adletters/(*)/(*)/?$ adletters.php?ver=$1&mod=$2 
>
> RewriteRule ^room/(*)/(*)/(*)/?$ room.php?ver=$1&rid=$2&nocache=$3 
> RewriteRule ^add/(*)/(*)/(*)/?$ add.php?ver=$1&rid=$2&nocache=$3 
> RewriteRule ^room/(*)/(*)/(*)/(*)/?$ room.php?ver=$1&rid=$2&act=$3&nocache=$4 
> RewriteRule ^mroom/(*)/(*)/(*)/?$ mroom.php?ver=$1&rid=$2&nocache=$3 
> RewriteRule ^intim/(*)/(*)/(*)/?$ intim.php?ver=$1&key=$2&nocache=$3 
> RewriteRule ^intim/(*)/(*)/?$ intim.php?ver=$1&nocache=$2 
> RewriteRule ^key/(*)/(*)/?$ key.php?ver=$1&act=invalid 
> RewriteRule ^intim/(*)/(*)/(*)/?$ intim.php?ver=$1&key=$2&nocache=$3 
> RewriteRule ^intim/(*)/(*)/(*)/(*)/(*)/?$ intim.php?ver=$1&key=$2&z=$3&msg=$4&nocache=$5 
> RewriteRule ^ihistory/(*)/(*)/(*)/?$ ihistory.php?ver=$1&key=$2&nocache=$3 
> RewriteRule ^info/(*)/(*)/(*)/(*)/?$ info.php?ver=$1&rid=$2&nocache=$3&uid=$4 
> RewriteRule ^info/(*)/(*)/(*)/(*)/(*)/?$ info.php?ver=$1&rid=$2&uid=$3&nocache=$4&act=$5 
> RewriteRule ^infoi/(*)/(*)/(*)/(*)/?$ infoi.php?ver=$1&key=$2&nocache=$3&uid=$4 
> RewriteRule ^infoi/(*)/(*)/(*)/(*)/(*)/?$ infoi.php?ver=$1&key=$2&uid=$3&nocache=$4&act=$5 
> RewriteRule ^addi/(*)/(*)/(*)/?$ addi.php?ver=$1&key=$2&nocache=$3 
> RewriteRule ^fotko/(*)/(*)/?$ fotko.php?ver=$1&uid=$2 
>
> RewriteRule ^videot/(*)/(*)/?$ videot.php?ver=$1&uid=$2 
>
>
> RewriteRule ^info/(*)/(*)/?$ info.php?act=$1&site=$2 
> RewriteRule ^ignor/(*)/(*)/(*)/?$ ignor.php?ver=$1&mod=$2&uid=$3 
> RewriteRule ^room/(*)/(*)/(*)/(*)/?$ room.php?ver=$1&rid=$2&nocache=$3&to=$4 
> RewriteRule ^rules/(*)/?$ rules.php?ver=$1 
> RewriteRule ^rules/(*)/(*)/?$ rules.php?ver=$1&action=$2 
> RewriteRule ^registration/(*)/(*)/?$ registration.php?ver=$1&nocache=$2 
> RewriteRule ^registration/(*)/(*)/(*)/?$ registration.php?ver=$1&asp=$2&nocache=$3 
> RewriteRule ^gazeta/(*)/?$ gazeta.php?ver=$1 
> RewriteRule ^stixi/(*)/?$ stixi.php?ver=$1 
> RewriteRule ^vstrechi/(*)/?$ vstrechi.php?ver=$1 
> RewriteRule ^faq/(*)/(*)/?$ faq.php?ver=$1&mod=$2 
> RewriteRule ^stats/(*)/?$ stats.php?ver=$1 
> RewriteRule ^allnews/(*)/?$ allnews.php?ver=$1 
> RewriteRule ^meets/(*)/?$ meets.php?ver=$1 
> RewriteRule ^kabinet/(*)/?$ kabinet.php?ver=$1 
> RewriteRule ^letters/(*)/?$ letters.php?ver=$1 
> RewriteRule ^bank/(*)/?$ bank.php?ver=$1 
> RewriteRule ^magazin/(*)/?$ magazin.php?ver=$1 
> RewriteRule ^galery/(*)/(*)/?$ galery.php?ver=$1&page=$2 
>
> RewriteRule ^videogalery/(*)/(*)/?$ videogalery.php?ver=$1&page=$2 
> RewriteRule ^videogalery/(*)/?$ videogalery.php?ver=$1 
>
> RewriteRule ^galery/(*)/?$ galery.php?ver=$1 
> RewriteRule ^online/(*)/?$ online.php?ver=$1 
> RewriteRule ^search/(*)/?$ search.php?ver=$1 
> RewriteRule ^games/dice/(*)/?$ games/dice.php?ver=$1 
> RewriteRule ^games/ugadaika/(*)/?$ games/ugadaika.php?ver=$1 
> RewriteRule ^embassies/(*)/?$ embassies.php?ver=$1 
> RewriteRule ^unlim/(*)/(*)/?$ unlim.php?rid=$1&ver=$2 
> RewriteRule ^room/(*)/(*)/?$ room.php?rid=$1&ver=$2 
> RewriteRule ^room/(*)/(*)/(*)/?$ room.php?rid=$1&ver=$2&ref=$3 
> RewriteRule ^key/(*)/?$ key.php?ver=$1 
> RewriteRule ^faq/(*)/?$ faq.php?ver=$1 
> RewriteRule ^faq/(*)/(*)/?$ faq.php?ver=$1&mod=$1& 
> RewriteRule ^(*)/(*)/?$ index.php?ver=$1&act=$2 
>   

The php configs you will need to put in your php.ini file.

The nginx rewrites can be generated at 
http://www.anilcetin.com/convert-apache-htaccess-to-nginx/ .

I think that you may want to add [L] to the end of each rule before 
using that tool or insert "last" before the semicolon at the end of each 
rule so nginx stops processing when it finds a match.

> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,4423,4423#msg-4423
>
>
>   
Jim






More information about the nginx mailing list