Welcome! Log In Create A New Profile

Advanced

rewrite

Posted by valdemarin 
rewrite
April 08, 2012 01:59PM
Я конечно глубоко извиняюсь, вас уже наверное достали с этим rewrite, но попрошу о помощи, ибо http://www.anilcetin.com/convert-apache-htaccess-to-nginx/ не дает внятного конфига, и ошибки при перезапуске nginx происходят, короче говоря есть данный rewrite от определенного движка:

RewriteRule ^index.html+$ index.php [QSA,L]
RewriteRule code.jpg+$ engine/antibot.php [QSA,L]
RewriteRule ref-([0-9]+).html index.php?ref=$1 [QSA,L]
RewriteRule ^([a-zA-Z_]+).html index.php?do=$1 [QSA,L]
RewriteRule ^([0-9a-zA-Z:\-]+)-static.html index.php?do=static&cid=$1 [QSA,L]
RewriteRule ^([a-zA-Z_]+)-lang.html index.php?langs=$1 [QSA,L]
RewriteRule forum_([0-9]*).html index.php?do=forums&fd=$1 [QSA,L]
RewriteRule topic_([0-9]*).html index.php?do=forums&messid=$1 [QSA,L]
RewriteRule forums-([a-zA-Z_]+).html index.php?do=forums&stp=$1 [QSA,L]
RewriteRule ^([0-9]*)-view.html index.php?do=view&n=$1 [QSA,L]
RewriteRule ^([0-9]*)-view-([a-zA-Z_]+).html index.php?do=view&n=$1&id=$2 [QSA,L]
RewriteRule ^([0-9a-zA-Z:\-]+)-user.html index.php?do=user&$1 [QSA,L]
RewriteRule error-([0-9]+).html index.php?do=user&login&err=$1 [QSA,L]
RewriteRule ([a-zA-Z_]+)_([0-9]+).html index.php?do=user&$1&n=$2 [QSA,L]
RewriteRule ([a-zA-Z_]+)_([0-9]+)_myserv.html index.php?do=user&myserv&$1&n=$2 [QSA,L]
RewriteRule ^([0-9a-zA-Z:\-]+)-game.html index.php?game=$1 [QSA,L]
RewriteRule ^([0-9a-zA-Z:\-]+)-game-([0-9]+).html index.php?game=$1&page=$2 [QSA,L]
RewriteRule a1pay.html+$ index.php?a1pay [QSA,L]
RewriteRule api.xml+$ index.php?api [QSA,L]
RewriteRule serv([0-9]*)-recommend.html+$ index.php?recommend&n=$1 [QSA,L]
RewriteRule ^([0-9]*)_players.html+$ index.php?players&n=$1 [QSA,L]
RewriteRule ^([0-9]*)_settings.html+$ index.php?settings&n=$1 [QSA,L]
RewriteRule ^([0-9]*)_location.html+$ index.php?location&n=$1 [QSA,L]
RewriteRule ^([0-9]*)_doLocation.html+$ index.php?doLocation&n=$1 [QSA,L]
RewriteRule ^([0-9]*)_history.html+$ index.php?history&n=$1 [QSA,L]
RewriteRule ^([0-9]*)_doHistory.html+$ index.php?doHistory&n=$1 [QSA,L]
RewriteRule ^([0-9]*)_webml.html+$ all.php?n=$1&do=webml [QSA,L]
RewriteRule ^([0-9]*)_([0-9a-zA-Z:\-]+).png+$ all.php?n=$1&do=$2 [QSA,L]
RewriteRule ^([0-9]*)_([a-zA-Z_]+)_([a-zA-Z_]+).png+$ all.php?n=$1&col=$2&do=$3 [QSA,L]


Помогите с праильным переводом в nginx конфиг.
Re: rewrite
April 09, 2012 06:07AM
Вроде работает, сделал так:

rewrite "^/monitor/index.html+$" /monitor/index.php last;
rewrite "^/monitor/code.jpg+$" /monitor/engine/antibot.php last;
rewrite "^/monitor/ref-([0-9]+).html" /monitor/index.php?ref=$1 last;
rewrite "^/monitor/([a-zA-Z_]+).html" /monitor/index.php?do=$1 last;
rewrite "^/monitor/([0-9a-zA-Z:\-]+)-static.html" /monitor/index.php?do=static&cid=$1 last;
rewrite "^/monitor/([a-zA-Z_]+)-lang.html" /monitor/index.php?langs=$1 last;
rewrite "^/monitor/forum_([0-9]*).html" /monitor/index.php?do=forums&fd=$1 last;
rewrite "^/monitor/topic_([0-9]*).html" /monitor/index.php?do=forums&messid=$1 last;
rewrite "^/monitor/forums-([a-zA-Z_]+).html" /monitor/index.php?do=forums&stp=$1 last;
rewrite "^/monitor/([0-9]*)-view.html" /monitor/index.php?do=view&n=$1 last;
rewrite "^/monitor/([0-9]*)-view-([a-zA-Z_]+).html" /monitor/index.php?do=view&n=$1&id=$2 last;
rewrite "^/monitor/([0-9a-zA-Z:\-]+)-user.html" /monitor/index.php?do=user&$1 last;
rewrite "^/monitor/error-([0-9]+).html" /monitor/index.php?do=user&login&err=$1 last;
rewrite "^/monitor/([a-zA-Z_]+)_([0-9]+).html" /monitor/index.php?do=user&$1&n=$2 last;
rewrite "^/monitor/([a-zA-Z_]+)_([0-9]+)_myserv.html" /monitor/index.php?do=user&myserv&$1&n=$2 last;
rewrite "^/monitor/([0-9a-zA-Z:\-]+)-game.html" /monitor/index.php?game=$1 last;
rewrite "^/monitor/([0-9a-zA-Z:\-]+)-game-([0-9]+).html" /monitor/index.php?game=$1&page=$2 last;
rewrite "^/monitor/a1pay.html+$" /monitor/index.php?a1pay last;
rewrite "^/monitor/api.xml+$" /monitor/index.php?api last;
rewrite "^/monitor/serv([0-9]*)-recommend.html+$" /monitor/index.php?recommend&n=$1 last;
rewrite "^/monitor/([0-9]*)_players.html+$" /monitor/index.php?players&n=$1 last;
rewrite "^/monitor/([0-9]*)_settings.html+$" /monitor/index.php?settings&n=$1 last;
rewrite "^/monitor/([0-9]*)_location.html+$" /monitor/index.php?location&n=$1 last;
rewrite "^/monitor/([0-9]*)_doLocation.html+$" /monitor/index.php?doLocation&n=$1 last;
rewrite "^/monitor/([0-9]*)_history.html+$" /monitor/index.php?history&n=$1 last;
rewrite "^/monitor/([0-9]*)_doHistory.html+$" /monitor/index.php?doHistory&n=$1 last;
rewrite "^/monitor/([0-9]*)_webml.html+$" /monitor/all.php?n=$1&do=webml last;
rewrite "^/monitor/([0-9]*)_([0-9a-zA-Z:\-]+).png+$" /monitor/all.php?n=$1&do=$2 last;
rewrite "^/monitor/([0-9]*)_([a-zA-Z_]+)_([a-zA-Z_]+).png+$" /monitor/all.php?n=$1&col=$2&do=$3 last;

Правильна ли такая конфигурация?
PS. Скрипт лежит в http://mysite.ru/monitor/



Edited 2 time(s). Last edit at 04/09/2012 06:08AM by valdemarin.
Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 88
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready