开发者

htaccess rewrite for https

Given this rule (that strips www from urls for http):

< IfModule mod_rewrite.c >
   RewriteCond %{HTTPS} !=on
   RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
   RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</ IfModule >

how do I configure the rewrite to work for 开发者_运维问答https as well?


A simple search found this:

# remove www from host
RewriteCond %{HTTP_HOST} ^www\.(.+)
RewriteCond %{HTTPS}s/%1 ^(on(s)|offs)/(.+)
RewriteRule ^ http%2://%3%{REQUEST_URI} [L,R=301]

Note: the [L] directive may be redundant in your case if it's not the [L]ast rule applied...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜