Skip to content
Advertisement

Laravel 6 redirecting to https://www.example.com/index.php when I press enter in the address bar with an address of www.example.com/profile?

I would think others are having the same issue. I am on a shared server with Inmotion Hosting creating basic profile pages. When I put my cursor up in the address bar for example the url ‘https://www.example.com/profile‘ and press enter Laravel brings up http://www.example.com/index.php which is a blank page. This only happens in Chrome. I am guessing it may have to do with my .htaccess file? Below is that file. Any ideas?

<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 %{HTTP_HOST} ^pollaclicks.com [NC] 
RewriteCond %{HTTPS} off 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Advertisement

Answer

This link https://www.example.com/profile (considering it to be example) does not exists and hence it is redirected to http://www.example.com/index.php with reference to your example links and rules written in your .htaccess file.

In .htaccess file these rules are creating the issue :

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

It means that if the file with the specified name doesn’t exist, or the directory doesn’t exist then proceed to the rewrite rule below.

The [L] flag causes mod_rewrite to stop processing the rule set

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement