Answer the question
In order to leave comments, you need to log in
nginx rules with htaccess conversion not working?
There are rules in .htaccess
RewriteEngine on
RewriteRule ^category/(.*) index.php?module=category&name=$1 [L]
RewriteRule ^page/(.*) index.php?module=page&name=$1 [L]
RewriteRule ^good/(.*) index.php?module=good&name=$1 [L]
RewriteRule ^case/(.*) index.php?module=case&name=$1 [L]
RewriteRule ^item/(.*) index.php ?module=item&name=$1 [L]
RewriteRule ^user/(.*) index.php?module=user&id=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.* )$ index.php?module=$1 [L,QSA]
RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L ]
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
Converted them using the _winginx.com/ru/htaccess service
# nginx configuration
location /category {
rewrite ^/category/(.*) /index.php?module=category&name=$1 break;
}
location /page {
rewrite ^/page/(.*) /index.php?module=page&name=$1 break;
}
location /good {
rewrite ^/good/(.*) /index.php?module=good&name=$1 break;
}
location /case {
rewrite ^/case/(.*) /index.php?module=case&name=$1 break;
}
location /item {
rewrite ^/item/(.*) /index.php?module=item&name=$1 break;
}
location /user {
rewrite ^/user/(.*) /index.php?module=user&id=$1 break;
}
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?module=$1 break;
}
if ($request_uri ~ "/+[^\.]+$"){
rewrite ^/(.+[^/])$ /$request_uri/ redirect;
}
if ($http_host ~* "^www\.(.*)"){
rewrite ^(.*)$ http://%1/$1 redirect;
}
}
The result flooded /etc/nginx/sites-available (Debian 8)
but does not work.
Where to dig?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question