Stack Overflow на русском Asked on November 20, 2021
Есть сервер на nginx
.
Мне необходимо настроить 301 редирект со страниц example.com/about.html на example.com/about/,
example.com/about.htm на example.com/about/ и т.д., чтобы исключить дубли и ошибочные страницы.
server {
listen 80;
server_name ${VIRTUAL_HOST};
# redirect all http to https
return 301 https://$server_name$request_uri;
}
Попробуйте так:
if ($request_uri ~ "^(.*).(?:php|html|htm)") {
return 301 $1;
}
Answered by Alexander on November 20, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP