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 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作