user image

Eslam Zedan
Published in : 2022-02-28

Laravel force redirect to https

Servers, Hosting

Hello,

I am trying to force redirect https + remove public folder from url so I was using this .htaccess file

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

Then as I found this in https://dev.to/skipperhoa/laravel-redirect-http-to-https-via-htaccess-5d39 I change my file  to 

 

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

but all asset files do not load properly  they need to add public in their URL to load fine

I am on GoDaddy shared host

Comments

There is no comments yet

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

What is the way to identify hardware configurations for small business application?
Publish date: 2022-05-12 | Comments: 1

Servers, Hosting

How to convert .pfx file to .crt file for Tomcat server?
Publish date: 2022-02-27 | Comments: 2

Servers, Hosting

How to setup HTTPS or SSL on my web application which is running on Tomcat server?
Publish date: 2022-02-27 | Comments: 3

Servers, Hosting