栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

将http://www.example.com重定向到http://example.com

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

将http://www.example.com重定向到http://example.com

阿帕奇

这应该是

# .htaccess file contents# Apache has the same docroot as the Java web app.# Java webapp is running on port 8084<IfModule mod_rewrite.c>RewriteEngine OnRewritebase /# For sites running on a port other than 80RewriteCond %{HTTP_HOST}   !^domain.com [NC]RewriteCond %{HTTP_HOST}   !^$RewriteCond %{SERVER_PORT} !^80$RewriteRule ^/(.*)         http://domain.com:%{SERVER_PORT}/$1 [L,R]# And for a site running on port 80RewriteCond %{HTTP_HOST}   !^domain.com [NC]RewriteCond %{HTTP_HOST}   !^$RewriteRule ^/(.*)         http://domain.com/$1 [L,R]</IfModule>

http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

雄猫

您可以在Tomcat中使用UrlRewriteFilter。这样的规则应该在
/WEB-INF/urlrewrite.xml中 为您工作:

<rule enabled="true">    <name>Force HTTPS example</name>    <note>Automatically redirects user requests.</note>    <from>http://domain.com/(.*)$</from>    <to type="permanent-redirect" last="true">http://www.domain.com/</to></rule>

不知道我是否打错了,写在头上



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/422091.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号