Answer the question
In order to leave comments, you need to log in
apache rules for nginx?
Hello. Please help me migrate htaccess rules to nginx.
Answer the question
In order to leave comments, you need to log in
# Бан "плохих" ботов для снижения нагрузки на серверп
RewriteCond %{HTTP_USER_AGENT} (AhrefsBot|MJ12bot|DotBot|BUbiNG\ Crawler|BUbiNG|FaceBook\ Crawler|FaceBook|SemrushBot|LinkdexBot|Alexa\ Robot|Alexa|Ads.txt-crawler|Powermarks|GrapeshotCrawler|grapeshot|SimplePie|360Spider|CCBot|SeznamBot|LinkpadBot|BLEXBot) [NC]
RewriteRule .* - [R=403,L]
# Обратная совместимость со старыми страницами
RewriteRule ^pages/(.*)$ /page/$1 [L,R=301]
# Редирект с WWW
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
server {
listen ip:80;
server_name www.111.com;
return 301 http://111.com$request_uri;
}
server {
listen ip:80;
server_name 111.com;
if ($http_user_agent ~* "(AhrefsBot|MJ12bot|DotBot|BUbiNG\ Crawler|BUbiNG|FaceBook\ Crawler|FaceBook|SemrushBot|LinkdexBot|Alexa\ Robot|Alexa|Ads.txt-crawler|Powermarks|GrapeshotCrawler|grapeshot|SimplePie|360Spider|CCBot|SeznamBot|LinkpadBot|BLEXBot)") {
return 403;
}
rewrite ^/pages/(.*)$ /page/$1 permanent;
server {
listen ip:80;
server_name 111.com www.111.com;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question