当我尝试访问http://localhost/myproject/public/login时,我找不到登录和注册页面,这是行不通的,但是当我像这样http://localhost/myproject/public/index.php/login添加index.php时,这是正常的。我该怎么办?
答案 0 :(得分:0)
在根文件夹上创建.htaccess文件,并将此文件也复制到公用文件夹中,并将此代码粘贴到文件中
<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]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>