无法通过https查找图像

时间:2017-07-01 10:21:59

标签: php apache laravel https

我有一个问题。我正在尝试通过https(使用letsencrypt)为我的网店提供服务。我在.htaccess文件中添加了以下内容,以指示通过https的所有流量:

# All HTTPS to HTTP.
RewriteEngine on
RewriteBase /
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://www.domain.nl%{REQUEST_URI} [L,R=301]

我在ubuntu 16.04服务器上使用apache2。我的根目录/domain_files/uploads中有一个文件夹,其中301为/var/www/domain/uploads/

现在,图片不再可用于https https://www.domain.nl/uploads/profilepictures/MXY6x2r8t4U_facebook_profilepic.jpg

httphttp://www.domain.nl/uploads/profilepictures/MXY6x2r8t4U_facebook_profilepic.jpg

2 个答案:

答案 0 :(得分:0)

我认为以下代码对您有所帮助。我得到了解决方案。

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteCond %{HTTPS} off
   RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

答案 1 :(得分:0)

我的Apache2中似乎有一个不同的.conf文件专门用于https://连接。我更新了301路径并且它有效!

相关问题