是的,我知道这个问题已经问过1000次了.这就是区别..。
我在StackOverflow上找到了这个答案,可以在这里添加"www“:use htaccess to add www with https support
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]这是我所见过的最美丽、最优雅的解决方案:
它工作的connections
所以,我的问题很简单。有人能帮我把这段代码调整成相反的方向吗?(删除万维网的网页地址和地址)?
我相信,在以上(希望是下面)解决方案之间,我们将让www重写来统治所有的解决方案!
发布于 2011-10-06 00:25:36
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%2://%1%{REQUEST_URI} [L,R=301]取自Drupal 7 .htaccess文件,工作起来很有魅力。更新了一点,以添加https检查。
发布于 2014-09-24 19:12:34
我对上面的答案有问题,它开始重定向到http://http:///
所以我做了一些修改,这是为我工作的代码(在apache2 Ubuntu服务器,VPS服务器上),将从http://www.example.com重定向到http://example.com (www到non ),从http://example.com重定向到https://example.com (http到https)。
RewriteCond %{HTTPS}s on(s)|
RewriteCond %{HTTP_HOST} ^www\.(.+)$
RewriteRule ^ http%2://%1%{REQUEST_URI} [R=301,L]发布于 2018-04-15 23:38:08
下面是一个只有两行的版本,可以在Apache和LiteSpeed上使用
RewriteCond %{HTTPS}s-%{HTTP_HOST} ^(on(s)|offs)-www\.(.+)$ [NC]
RewriteRule ^(.*)$ http%2://%3/$1 [L,R=301]https://stackoverflow.com/questions/7669200
复制相似问题