nginx 不带www到www域名的重定向 这里,如果是单次重定向用 redirect, 如果永久跳转用 permanent,这里用 permanent
{
【nginx 不带www到www域名的重定向】listen80;
server_namexxx.com www.xxx.com;
index index.html index.php;
root/data/www/wwwroot;
if ($http_host !~ "^www.xxx.com$") {
rewrite^(.*)http://www.xxx.com$1 permanent;
}
........................
}
推荐阅读
- Linux|109 个实用 shell 脚本
- linux笔记|linux 常用命令汇总(面向面试)
- Linux|Linux--网络基础
- linux|apt update和apt upgrade命令 - 有什么区别()
- linux|2022年云原生趋势
- Go|Docker后端部署详解(Go+Nginx)
- 开源生态|GPL、MIT、Apache...开发者如何选择开源协议(一文讲清根本区别)
- GitHub|7 款可替代 top 命令的工具