例如,要把域名 test.com,重定向到 www.test.com,则需要修改 Apache 中站点的配置文件,添加 301 重定向的配置。

最主要就是以下配置:

 

1 ServerName test.com        #绑定的域名test.com
2 RedirectMatch  permanent  ^/(.*)  http://www.test.com/$1       #访问test.com,都跳转到www.test.com 

 

Linux 系统 Apache 301 重定向配置方法

 

添加好 Apache 的配置后,重启 Apache 生效,然后访问 test.com,就会 301 跳转到 www.test.com :

 

Linux 系统 Apache 301 重定向配置方法

相关文章:

  • 2021-10-17
  • 2022-12-23
  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-17
  • 2022-01-09
猜你喜欢
  • 2021-07-24
  • 2022-01-11
  • 2022-02-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-11
相关资源
相似解决方案