Welcome! Log In Create A New Profile

Advanced

nginx mod rewite issue

Posted by gkroxm 
nginx mod rewite issue
May 18, 2017 07:18AM
i'm trying to Convert Apache rewrite to nginx but mnay b due to some error i will fail please have a look

Apache version

DirectoryIndex index.php
<Files ~ "^\.ht">
order allow,deny
satisfy all
</Files>
# Deny most common except .php (Also protects your .tpl template files)
<FilesMatch "\.(db|inc|tpl|tmpl|h|ihtml|sql|ini|class|bin|spd|theme|module|cfg|cpl|tmp|log|err)$">
order allow,deny
satisfy all
</FilesMatch>
RewriteEngine On
RewriteRule ^sitemap.xml(/?)+$ sitemap.php [L]
RewriteRule ^search.html(/?)+$ ?do=search&%{QUERY_STRING} [L]
RewriteRule ^user(/?)+$ ?do=user&%{QUERY_STRING} [L]
RewriteRule ^users/([^/]*).html(/?)+$ ?do=users&iq=$1&%{QUERY_STRING} [L]
RewriteRule ^user/browse/([A-Z])(/?)+$ ?do=user&browse=$1 [L]
RewriteRule ^library(/?)+$ ?do=library&%{QUERY_STRING} [L]
RewriteRule ^contribute(/?)+$ ?do=contributions&%{QUERY_STRING} [L]
RewriteRule ^extras/print/([^/]*)-([^/]*).html(/?)+$ extras/print.php?iq=$2 [L]
RewriteRule ^extras/txt/([^/]*)-([^/]*).txt(/?)+$ extras/text.php?iq=$2 [L]
RewriteRule ^extras/pdf/([^/]*)-([^/]*).pdf(/?)+$ extras/pdf/pdf_output.php?iq=$2 [L]
RewriteRule ^extras/word/([^/]*)-([^/]*).doc(/?)+$ extras/word/word_output.php?iq=$2 [L]
RewriteRule ^images/user/([^/]*).jpg(/?)+$ image.php?t=users&iq=$1 [L]

And mine nginx version is

# nginx configuration
index index.php;
location /sitemap {
rewrite ^/sitemap.xml/*$ /sitemap.php break;
}
location /search {
rewrite ^/search.html/*$ /?do=search&$query_string break;
}
location /user {
rewrite ^/user/*$ /?do=user&$query_string break;
rewrite ^/user/browse/([A-Z])/*$ /?do=user&browse=$1 break;
}
location /users {
rewrite ^/users/([^/]*).html/*$ /?do=users&iq=$1&$query_string break;
}
location /library {
rewrite ^/library/*$ /?do=library&$query_string break;
}
location /contribute {
rewrite ^/contribute/*$ /?do=contributions&$query_string break;
}
location /extras {
rewrite ^/extras/print/([^/]*)-([^/]*).html/*$ /extras/print.php?iq=$2 break;
rewrite ^/extras/txt/([^/]*)-([^/]*).txt/*$ /extras/text.php?iq=$2 break;
rewrite ^/extras/pdf/([^/]*)-([^/]*).pdf/*$ /extras/pdf/pdf_output.php?iq=$2 break;
rewrite ^/extras/word/([^/]*)-([^/]*).doc/*$ /extras/word/word_output.php?iq=$2 break;
}
location /images {
rewrite ^/images/user/([^/]*).jpg/*$ /image.php?t=users&iq=$1 break;
}
location ~ ^\.ht {
deny all;
}
location ~ \.(db|inc|tpl|tmpl|h|ihtml|sql|ini|class|bin|spd|theme|module|cfg|cpl|tmp|log|err)$ {
deny all;
}
i'm Using cloudlinux + whm + Cpnginx for ngixn

Please help me to track the issue thanks in advance
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 271
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