Issue with accessing https

24 views Asked by At

I have an app build in Laravel but have issues in accessing pages through https. Example, if I access geepay.in, the app redirects to https

However, if I access http://geepay.in/9860494211 it redirects to https domain index.php

(Also if I remove the script from htacess, the app stops working and throws error).

My htacess files contains the following

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

#Hadle https
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

</IfModule>

AddHandler application/x-httpd-php55  .php55 .php

How I can fix this issue?

1

There are 1 answers

0
Sumurai8 On

You simply fix this issue by swapping the rewrite and https-redirect. In your case, Apache will match rule 2 first. Then rule 1 and 2 do no longer match and you match rule 3. Since you have already rewritten the url, you perform the redirect with the rewritten url.

If you swap the rules, the redirect will be matched first. Afterwards, the new request will match your rule 2 (then 3), and let Laravel handle the request.