duanouyong4228 2015-10-08 20:50
浏览 60
已采纳

使用laravel 5从url中删除index.php

I checked many posts here about removing index.php from url but I could not get the desired results, I already added my local url site name to virtual hosts file (I use wamp) and when I write url like this it work http://first-app.com

My problem when I navigate to another folder like "songs" this url does not work, I get url not found

http://first-app.com/songs

while if I used index.php it work

http://first-app.com/index.php/songs

here is my httpd-vhosts.conf file:

<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>

Can that be solved from modifying this file ? or I need to modify .htaccess file located at the public folder ? here it is:

<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>
  • 写回答

1条回答 默认 最新

  • duanfoumi5620 2015-10-09 12:00
    关注

    All I need was to enable rewrite_module in the apache server then restart, since I use wamp I only selected the module from the list menu

    Here is a complete list how it can be done for Mac, Linux and Windows

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器