我最近刚刚使用SSL证书更新了我们的网站。我们正在重写网址,在输入http://example.com或http://www.example.com时,这会转换为https://example.com
但是我们发现很多访问者都有链接到特定页面或文件的收藏夹,并且.htaccess翻译失败。
例如点击收藏夹时 http://example.com/themes/default/images/emailLogo.png 然后,访问者被引导到 https://example.comthemes/default/images/emailLogo.png(注意网址中缺少的斜杠)
这是我的.htaccess文件信息
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule ^images/.+$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} !(example\.org|example-me.org|example.me)$
RewriteRule ^(.*)$ https://example.org/$1 [R=302,L]
RewriteRule ^http://example.org/images/(.*) https://example.org/images/$1 [R]
RewriteRule ^http://www.example.org/images/(.*) https://example.org/images/$1 [R]
RewriteRule ^(.+)\.html$ /bootstrap.php?file=$1.html [L,NC,QSA]
RewriteRule ^(.+)\.phtml$ /bootstrap.php?file=$1.html [L,NC,QSA]
</IfModule>
ErrorDocument 404 /404.php
DirectoryIndex index.html index.php
答案 0 :(得分:0)
如果其他人偶然发现这篇文章,我发现了这个问题。 apache配置中有一个重定向,它将所有端口80的请求重定向到 https://example.com
我将其更改为https://example.com/
(*注意尾部斜线*)