【发布时间】:2018-07-28 07:23:52
【问题描述】:
我在 .htaccess 文件中添加了此代码 https://stackoverflow.com/a/13997498/2311074,以始终将我的网站重定向到 https://www.**********。这适用于 Chrome,但不适用于 Firefox。
如果我进入
https://example.com
然后它不会重定向到任何地方。
在火狐中。在 Chrome 中,它们被正确重定向到 https://www.example.com。
我已经删除了缓存并尝试从其他 PC 调用该网站,但仍然无法正常工作。这是我来自 Laravel 的 htaccess 文件:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
# [NC] is a case-insensitive match
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
我做错了什么?
【问题讨论】:
-
你在火狐的隐私模式下试过了吗?
-
@Karolis 是的,在私人模式和其他电脑(Windows 7 和 ubuntu)上。重定向仍在发生,网址是coaching-institutes.net