【发布时间】:2016-06-28 18:42:56
【问题描述】:
我在我的根域中安装了 CI。 SSL 证书已安装并正常工作。当我将 http:// 重定向到 https://www 时,它会重定向到 https://www.www(额外的 www),正如用户报告的那样,在某些计算机和某些浏览器上也是如此。但是,当我从重定向中删除“www”时,一切都很好。好像 www 正在循环。到目前为止,我已经挖掘了我的代码一百次,并且没有看到代码重定向的迹象(我的意思是添加了额外的 www)。我正在用 htaceess 做这件事。任何帮助将不胜感激。这是我的 htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Force SSL
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R,L]
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [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
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
我用 Centos VPS 在 apache 上运行它。
非常感谢!
【问题讨论】:
标签: apache .htaccess https url-redirection centos6