Oct 16, 2016
0
Level 4
SSL .htaccess the right way?
I'm hosting my website on Cloudways. I noticed that when I use .htaccess below, response->statusText is always null and also redirect->back is always set to root domain instead of the previous domain.
I think this .htaccess is causing problems to my code. Can someone tell me how the correct .htaccess for Laravel should look like? Also forcing https and non-www??
Regards
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.eu [NC]
RewriteRule ^(.*)$ http://example.eu/$1 [L,R=301]
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
Please or to participate in this conversation.