重写https和www [英] rewrite https and www
本文介绍了重写https和www的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
现在我有一个网站https.
now I have a website https.
http://www.example.com -> 但是,我在 www 上遇到了问题 ://example.com-> s://example.com =不好
But, I have a problem with www ://example.com -> s://example.com = not good
我想在下面进行此重定向: ://example.com-> s://www.example.com
I would like to have this redirection below : ://example.com -> s://www.example.com
如何使用RewriteCond和RewriteRule?救救我吧!
How with RewriteCond and RewriteRule ? Help me plz !
谢谢!
推荐答案
对所有请求强制实施https并重定向到 www .example.com
To enforce https on all requests and redirect to www.example.com
# force https and www
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.example.com%{REQUEST_URI} [R,L]
# if already https without www
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^ https://www.example.com%{REQUEST_URI} [R,L]
这篇关于重写https和www的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文