Linux 服务器上的 Apahce 如何配置 301 重定向?

赞赏 2016-07-12

一般是通过修改 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 

QQ截图20151023190246.png

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

QQ截图20151029041316.png

登陆后阅读全文
阅读 1546 赞赏 0 有用 0 没用 0 收藏 0 分享

   



0 条留言

linux分享的头像

linux分享

每个软件都有确定的用途

相关文章

阿里云·业务运营团队内部的前端构建和工程化工具 Dawn开源

Apache 如何关闭目录访问?

Linux Apache 运行配置参数的调优

阿里云云盾扫描服务器的的IP段有哪些?

阿里云云盾扫描服务器的的IP段有哪些?

tomcat报warinig Unable to add the resource at [] to the cache

Apache 出现 winnt_accept: Asynchronous AcceptEx faile?

linux下如何开启 Apache 伪静态模块?

如何隐藏 Apache 版本信息?

CentOS 6.5系统下 Apache 如何配置 https 服务?

他的文章

我是如何执行 "rm -rf ~" 的

正态分布为什么常见?(财富的分布却不符合正态分布)

Linux下窗口管理器 xmonad 的使用教程

用披萨做比喻来解释 IaaS,PaaS,SaaS 的区别

如何制作CSR(证书私钥和证书请求文件)文件?

php RedisException with message read error on connection

Linux下ping丢包或不通时链路测试工具推荐

Windows环境下ping丢包或不通时链路测试工具推荐

链路测试结果分析说明及常见链路异常场景和测试报告

SSH 登录时出现如下错误:login: Module is unknown

手机扫一扫
分享文章