Answer the question
In order to leave comments, you need to log in
How to rewrite htaccess rules under nginx?
Here are the htaccess rules:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteRule ^rss\.xml$ /data/ rss.php [L]
RewriteRule ^sitemap\.xml$ /data/sitemap.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)?$ data/engine. php?a=$1 [QSA,NC,L]
Answer the question
In order to leave comments, you need to log in
server {
listen 80;
server_name www.site.ru;
return 301 http://site.ru$request_uri;
}
server {
listen 80;
server_name site.ru;
root /var/www/html;
rewrite ^/rss\.xml$ /data/rss.php;
rewrite ^/sitemap\.xml$ /data/sitemap.php;
location @handler {
rewrite ^/(.*)$ /data/engine.php?a=$1;
}
location / {
try_files $uri $uri/ @handler;
}
location ~ \.php$ {
try_files $uri =404;
# Тут нужно добавить свои параметры fastcgi
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question