laravel - .htaccess refuse open index.php
I have a .htaccess file like this :
DirectoryIndex index.php
<IfModule mod_rewrite.c>
<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]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
and route like this:
Route::get('/', function () {
return view('index',[
'bg' => 'bg-nayapink',
'active' =>'Home'
]);
});
Route::get('/services', function () {
return view('services', [
'active' => 'Services',
'bg' => 'bg-nayayellow'
]);
});
The problem is that whenever I tried to access "mysite.com" (mean: '/' route) it always opened index.html instead of index.php. Other routes are open normally, except the empty one. The website is already hosted on a shared server.
Answer
Solution:
I fixed it. It is because of the cache. Before this site, there was a site too already and has been deleted then overwritten with this one. So, I just need to clear all cache.
Source