![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 238 Pomógł: 0 Dołączył: 6.05.2011 Ostrzeżenie: (10%) ![]() ![]() |
Witam,
Próbowałem tą regułkę: Kod Options +FollowSymLinks RewriteEngine on ##point to installation directory ##if it is the root dir,enter / ##else /otherdir RewriteBase / RewriteCond %{QUERY_STRING} ^d=([a-zA-Z0-9]{8,12})$ RewriteRule ^$ download.php?id=%1&type=1 [L] RewriteCond %{QUERY_STRING} ^d=([a-zA-Z0-9]{12,16})$ RewriteRule ^$ delete.php?id=%1 [L] RewriteRule ^file/([0-9]+)/(.*)$ download.php?id=$1&name=$2&type=2&%{QUERY_STRING} [L] RewriteRule ^([a-z]{2})/file/([0-9]+)/(.*)$ download.php?setlang=$1&id=$2&name=$3&type=2 [L] RewriteRule ^myfolders/([0-9]+)-(.*)$ folders.php?fid=$1&name=$3&%{QUERY_STRING} [L] RewriteRule ^([a-z]{2})/myfolders/([0-9]+)-(.*)$ folders.php?setlang=$1&fid=$2&name=$3&%{QUERY_STRING} [L] RewriteRule ^topfiles/$ top.php [L] RewriteRule ^([a-z]{2})/topfiles/$ top.php?%{QUERY_STRING} [L] RewriteRule ^topfiles/index([0-9]*)\.html$ top.php?s=$1&%{QUERY_STRING} [L] RewriteRule ^([a-z]{2})/topfiles/index([0-9]*)\.html$ top.php?setlang=$1&s=$2&%{QUERY_STRING} [L] RewriteRule ^([a-z]{2})$ ?setlang=$1 [QSA,L] RewriteRule ^([a-z]{2})/$ ?setlang=$1 [QSA,L] RewriteRule ^([a-z]{2})/(.*)\.php$ $2.php?setlang=$1 [QSA,L] RewriteRule ^content/([0-9a-zA-Z]+)\.html$ page_template.php?page=$1 [QSA,L] <IfModule mod_security.c> # Turn off mod_security filtering. SecFilterEngine Off # The below probably isn't needed, # but better safe than sorry. SecFilterScanPOST Off </IfModule> Przekonwertować na stronie: http://www.anilcetin...ccess-to-nginx/ i wyszło tak: Kod if ($args ~ "^d=([a-zA-Z0-9]{8,12})$"){ set $rule_0 1$rule_0; set $bref_1 $1; } if ($rule_0 = "1"){ rewrite ^/$ /download.php?id=$bref_1&type=1 last; } if ($args ~ "^d=([a-zA-Z0-9]{12,16})$"){ set $rule_1 1$rule_1; set $bref_1 $1; } if ($rule_1 = "1"){ rewrite ^/$ /delete.php?id=$bref_1 last; } if ($rule_2 = ""){ rewrite / /; } if ($rule_3 = ""){ rewrite / /; } if ($rule_4 = ""){ rewrite / /; } if ($rule_5 = ""){ rewrite / /; } if ($rule_6 = ""){ rewrite / /; } if ($rule_7 = ""){ rewrite / /; } if ($rule_8 = ""){ rewrite / /; } if ($rule_9 = ""){ rewrite / /; } if ($rule_10 = ""){ rewrite ^/([a-z]{2})$ /?setlang=$1 last; } if ($rule_11 = ""){ rewrite ^/([a-z]{2})/$ /?setlang=$1 last; } if ($rule_12 = ""){ rewrite ^/([a-z]{2})/(.*).php$ /$2.php?setlang=$1 last; } if ($rule_13 = ""){ rewrite ^/content/([0-9a-zA-Z]+).html$ /page_template.php?page=$1 last; } Nie wszystko chyba przerobiło, a dodatkowo chyba z błędami. Bardzo proszę o ewentualne poprawki. |
|
|
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 48 Pomógł: 5 Dołączył: 18.06.2012 Ostrzeżenie: (0%) ![]() ![]() |
Tak sa błedy i nie ma wszystkiego. No, ale ja nie będę Ci wszystkiego tłumaczył, tu masz pomoc: http://wiki.nginx.org/HttpRewriteModule
Ode mnie przykłd: Kod if ($args ~ "^d=([a-zA-Z0-9]{8,12})$"){
rewrite ^/$ /download.php?id=$1&type=1 last; } if ($args ~ "^d=([a-zA-Z0-9]{12,16})$"){ rewrite ^/$ delete.php?id=$1 last; } -------------------- http://tropmy.net - narzędzie do badania usability stron WWW.
|
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 238 Pomógł: 0 Dołączył: 6.05.2011 Ostrzeżenie: (10%) ![]() ![]() |
Dziękuję za pomoc. Na razie zrobiłem tak jak poniżej. Proszę o sprawdzenie.
Kod if ($args ~ "^d=([a-zA-Z0-9]{8,12})$"){ rewrite ^/$ /download.php?id=$1&type=1 last; } if ($args ~ "^d=([a-zA-Z0-9]{12,16})$"){ rewrite ^/$ delete.php?id=$1 last; } rewrite ^/file/([0-9]+)/(.*)$ /download.php?id=$1&name=$2&type=2&%{QUERY_STRING} last; rewrite ^/([a-z]{2})/file/([0-9]+)/(.*)$ /download.php?setlang=$1&id=$2&name=$3&type=2 last; rewrite ^/myfolders/([0-9]+)-(.*)$ /folders.php?fid=$1&name=$3&%{QUERY_STRING} last; rewrite ^/([a-z]{2})/myfolders/([0-9]+)-(.*)$ /folders.php?setlang=$1&fid=$2&name=$3&%{QUERY_STRING} last; rewrite ^/topfiles/$ /top.php last; rewrite ^/([a-z]{2})/topfiles/$ /top.php?%{QUERY_STRING} last; rewrite ^/topfiles/index([0-9]*)\.html$ /top.php?s=$1&%{QUERY_STRING} last; rewrite ^/([a-z]{2})/topfiles/index([0-9]*)\.html$ /top.php?setlang=$1&s=$2&%{QUERY_STRING} last; rewrite ^/([a-z]{2})$ /?setlang=$1 last; rewrite ^/([a-z]{2})/$ /?setlang=$1 last; rewrite ^/([a-z]{2})/(.*)\.php$ /$2.php?setlang=$1 last; rewrite ^/content/([0-9a-zA-Z]+)\.html$ /page_template.php?page=$1 last; A tego to w ogóle nie ogarniam: Kod <IfModule mod_security.c> # Turn off mod_security filtering. SecFilterEngine Off # The below probably isn't needed, # but better safe than sorry. SecFilterScanPOST Off </IfModule> Jak mam to przerobić na nginx ? |
|
|
![]()
Post
#4
|
|
Grupa: Zarejestrowani Postów: 48 Pomógł: 5 Dołączył: 18.06.2012 Ostrzeżenie: (0%) ![]() ![]() |
Nie przerobisz, bo w nginxie nie ma mod_security, są inne rozwiazania, myślę że to się przyda https://calomel.org/nginx.html
Pozdrawiam -------------------- http://tropmy.net - narzędzie do badania usability stron WWW.
|
|
|
![]()
Post
#5
|
|
Grupa: Zarejestrowani Postów: 238 Pomógł: 0 Dołączył: 6.05.2011 Ostrzeżenie: (10%) ![]() ![]() |
Niestety wywala błąd;
Cytat Restarting nginx: nginx: [emerg] directive "rewrite" is not terminated by ";" in /etc/nginx/sites-enabled/host:82 nginx: configuration file /etc/nginx/nginx.conf test failed Czyli w linii: Cytat rewrite ^/file/([0-9]+)/(.*)$ /download.php?id=$1&name=$2&type=2&%{QUERY_STRING} last; Dlaczego? |
|
|
![]()
Post
#6
|
|
![]() Grupa: Moderatorzy Postów: 15 467 Pomógł: 1451 Dołączył: 25.04.2005 Skąd: Szczebrzeszyn/Rzeszów ![]() |
Takie zmienne są w nginx inaczej zapisywane: Kod rewrite ^/file/([0-9]+)/(.*)$ /download.php?id=$1&name=$2&type=2&$query_string last; Pisane z palca; popraw resztę analogicznie. -------------------- ![]() ZCE :: Pisząc PW załączaj LINK DO TEMATU i TYLKO w sprawach moderacji :: jakiś błąd - a TREŚĆ BŁĘDU? :: nie ponaglaj z odpowiedzią via PW! |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 31.07.2025 - 07:50 |