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...
精彩评论