Laravel:用于重定向到https的.htaccess规则不起作用

时间:2019-06-05 13:46:46

标签: apache .htaccess laravel-5 https

我正在开发一个laravel应用程序,需要为此强制使用HTTPS。我尝试了许多其他在互联网上找到的解决方案,但都无济于事。我的应用程序是否有可能忽略htaccess规则?

我已经尝试了以下解决方案: Laravel: how to force HTTPS?

这是我的httaccess文件:

<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]

    # Handle redirect to Https
    RewriteRule ^(.*)$ https://foody.ir/$1 [R,L]

</IfModule>

0 个答案:

没有答案