.htaccess https 只有匹配对应的域名才会跳转

小七 发表于:2018-08-30 19:55 复制链接 ?提问题 +写文章
阅读数:181
RewriteEngine On
RewriteBase /

#只有匹配对应的域名才会跳转
RewriteCond %{HTTP_HOST} !^www。SEOwhy7。com|wailian。eowhy7。com|m。seowhy7。com$ [NC]
RewriteRule ^(.*)$ https://www。seowhy7。com/$1 [L,R=301]

#http自动跳转到https
RewriteCond %{SERVER_PORT} !^443$
#只有匹配对应的域名才会跳转
RewriteCond %{SERVER_NAME} ^seowhy7。com|www。seowhy7。com$
RewriteRule (.*) https://www。seowhy7。com/$1 [R]

Redirect permanent https://www。seowhy。com/bbs/ https://www。seowhy7。com/
Redirect permanent http://bbs。seowhy。com/ https://www。seowhy7。com/

演示:

https://www。seowhy。com/bbs/thread-66779269-1-1.html 跳转到 https://www。seowhy7。com/thread-66779269-1-1.html

http://bbs。seowhy。com/thread-66779269-1-1.html 跳转到 https://www。seowhy7。com/thread-66779269-1-1.html

http://seowhy7。com/thread-66779269-1-1.html 跳转到 https://www。seowhy7。com/thread-66779269-1-1.html

http://www。seowhy7。com/thread-66779269-1-1.html 跳转到 https://www。seowhy7。com/thread-66779269-1-1.html

https://seowhy7。com/thread-66779269-1-1.html 跳转到 https://www。seowhy7。com/thread-66779269-1-1.html
返回列表 使用道具 举报
条评论
您需要登录后才可以回帖 登录 | 注册
高级
odella odella 发表于 2018-11-03 04:33 | 阅读全部
内容很不错,学习了
使用道具 举报
回复
edith edith 发表于 2018-12-14 22:01 | 阅读全部
很好很详细,对新手一定有帮助
使用道具 举报
回复
相关推荐

您的等级不够,“高级及以上会员” 开启

您的等级不够,“vip会员”开启