My website error 404 when use https redirect

Asked

Viewed 99 times

-1

My website error 404 when I switch htacces to redirect http to https, the code I’m using in htacces:

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https

RewriteCond %{HTTPS} off

RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

I’m using php - Laravel

  • And your site responds normally by accessing directly by HTTPS?

  • https://answall.com/a/143653/70

1 answer

0


RewriteEngine On
Options All -Indexes

# WWW Redirect.
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# HTTPS Redirect
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# URL Rewrite
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1

# WWW Redirect = Force redirect when typed WWW

# HTTPS Redirect = Forces redirect to HTTPS

# URL Rewrite = Apply the file conditions by applying the rules for files (!-f) and directories (!-d)

Apache documentation link, where an explanation more examples of possible settings.

Apache documentation

Browser other questions tagged

You are not signed in. Login or sign up in order to post.