云服务器 ECS Linux 系统 Apache 301 重定向配置方法
一般是通过修改 Apache 的站点配置文件来实现。 解决方案例如,要把域名 test.com,重定向到 www.test.com,则需要修改 Apache 中站点的配置文件,添加 301 重定向的配置。 最主要就是以下配置: - ServerName test.com #绑定的域名test.com
- RedirectMatch permanent ^/(.*) http://www.test.com/$1 #访问test.com,都跳转到www.test.com
复制代码添加好 Apache 的配置后,重启 Apache 生效,然后访问 test.com,就会 301 跳转到 www.test.com :
|