繁体   English   中英

非HTTPS URL在前端增加了额外的WWW

[英]Non HTTPS URL adds extra WWW infront

如果您访问非HTTPS版本 ,它将不会重定向到HTTPS版本。 而是看起来像https://www.www.mywebsite.com,并且无法正常工作。 这是我的htaccess文件中的代码。

 RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule .* https://www.%{SERVER_NAME}%{REQUEST_URI} [R=301,L] #Checks to see if the user is attempting to access a valid file, #such as an image or css document, if this isn't true it sends the #request to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index\\.php|public|images|robots\\.txt|css) RewriteRule ^(.*)$ index.php/$1 [L] 

删除www。 从这一行:

RewriteRule .* https://www.%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

或者您可以这样做:

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.mywebsite.com/$1 [R=301,L]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM