I am beginner in Laravel. I make my project in Laravel 5.8. I have website in domain: https://myname.com
I need .htacess with options: - redirect from http to https, - redirect from www.myname.com to myname.com
How can I make this?
I am beginner in Laravel. I make my project in Laravel 5.8. I have website in domain: https://myname.com
I need .htacess with options: - redirect from http to https, - redirect from www.myname.com to myname.com
How can I make this?
You have to have SSL certificate to use https. Here is my .htaccess file which works for me to redirect from http to https.
<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]
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.sitename.com/$1 [R,L]
</IfModule>
<IfModule mod_headers.c>
<FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css|css)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>