我在这里检查了许多关于从url中删除index.php的帖子,但是我无法获得所需的结果,我已经将我的本地url站点名称添加到虚拟主机文件(我使用wamp),当我写这样的url时它工作http://first-app.com
当我导航到另一个像“歌曲”这样的文件夹这个网址不起作用时我的问题,我找不到网址
http://first-app.com/songs
如果我使用index.php它可以工作
http://first-app.com/index.php/songs
这是我的httpd-vhosts.conf文件:
<Directory C:\wamp\www\composer-demo\first-app\public>
Order Deny,Allow
Allow from all
</Directory>
<VirtualHost *:80>
DocumentRoot "C:\wamp\www\composer-demo\first-app\public"
ServerName first-app.com
</VirtualHost>
可以通过修改此文件来解决吗?或者我需要修改位于公共文件夹的.htaccess文件?这是:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
答案 0 :(得分:0)
我只需要在apache服务器中启用rewrite_module
然后重新启动,因为我使用wamp我只从列表菜单中选择了模块
Here is a complete list how it can be done for Mac, Linux and Windows