How automatically to redirect laravel to public folder using .htaccess

Have you installed SSL On your website? We know that now you are eager to get it automatically redirected to the secured version of your website.

Go to your file manager > public_html > Click "Settings" > Click "Show Hidden .files"

Now create look for ".htaccess" file. If I does not exists create a new file and name it ".htaccess"

Now paste the code bellow

RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]

# force ssl
RewriteCond     %{SERVER_PORT} ^80$
RewriteRule     ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

 

Please rate this article to help us improve our Knowledge Base.

2 0




Hello , talk to a hosting specialist today and discover which options will work best for you.

+255 734 666 100