我想使用.htaccess从https上的url中删除www
我想通过.htaccess从https url中删除www。 比如说 我想换衣服 https://www.example.com/ 到 我试过很多规则我想使用.htaccess从https上的url中删除www,.htaccess,url-rewriting,.htaccess,Url Rewriting,我想通过.htaccess从https url中删除www。 比如说 我想换衣服 https://www.example.com/ 到 我试过很多规则 RewriteCond %{HTTPS} =on RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] RewriteRule ^(.*)$ https://example.come/$1 [L] 及 及 但什么都不管用。请帮我试试: RewriteCond %{HTTP_HOST}
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ https://example.come/$1 [L]
及
及
但什么都不管用。请帮我试试:
RewriteCond %{HTTP_HOST} ^www\.(.+)
RewriteCond %{HTTPS}s/%1 ^(on(s)|offs)/(.+)
RewriteRule ^ http%2://%3%{REQUEST_URI} [L,R=301]
请确保您正在使用X-Forwarding,然后尝试以下方法:
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://example.com/$1 [R,L]
这会尊重加入的任何计划吗?例如,
http://www.example.com
->http://example.com
和https://www.example.com
->https://example.com
RewriteCond %{HTTP_HOST} ^www\.(.+)
RewriteCond %{HTTPS}s/%1 ^(on(s)|offs)/(.+)
RewriteRule ^ http%2://%3%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://example.com/$1 [R,L]