问题描述
我将此代码 https://stackoverflow.com/a/13997498/2311074 添加到了.htaccess文件中始终将我的网站重定向到https://www.**********
.这在Chrome浏览器中有效,但在Firefox中不起作用.
I added to the .htaccess file this code https://stackoverflow.com/a/13997498/2311074 to redirect my website always to https://www.**********
. This works in Chrome, but it is not working in Firefox.
如果我输入
https://example.com
然后它就不会重定向到任何地方.
then its not redirecting anywhere.
.在Chrome中,它们已正确重定向到https://www.example.com
.
in Firefox. In Chrome they are correctly redirected to https://www.example.com
.
我Aready删除了缓存,并尝试从其他PC调用该网站,但该网站仍然无法正常工作.这是我来自Laravel的htaccess文件:
I aready deleted the cache and tried to call the website from other PC's but its still not working. This is my htaccess FIle from Laravel:
<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>
我在做什么错了?
推荐答案
问题是我只有域 www.example.org 的SSL证书,但不是域 example.org 的SSL证书.因此,URL https://example.org 无效,尚未加载,因此无法使用.htaccess
文件重定向.
The problem was that I only had a SSL certificate for the domain www.example.org but not a SSL certificate for the domain example.org. Thus the url https://example.org is invalid, was not loaded and could not be redirected with the .htaccess
file.
这篇关于Laravel:重定向到https://www.***在Firefox中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!