.htaccess拒绝打开index.php



我有一个.htaccess文件,如下所示:

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>

路线如下:

Route::get('/', function () {
return view('index',[
'bg' => 'bg-nayapink',
'active' =>'Home'
]);
});
Route::get('/services', function () {
return view('services', [
'active' => 'Services',
'bg' => 'bg-nayayellow'
]);
}); 

问题是每当我试图访问";mysite.com";(mean:'/'route(它总是打开index.html而不是index.php。除了空的路由外,其他路由都是正常打开的。该网站已托管在共享服务器上。

我修复了它。这是因为缓存。在此网站之前,也有一个网站,已被删除,然后被此网站覆盖。所以,我只需要清除所有缓存。

最新更新