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 Odoo17操作下面代码的模块时出现没有'读取'来访问
  • ¥50 .net core 并发调用接口问题
  • ¥15 网上各种方法试过了,pip还是无法使用
  • ¥15 用verilog实现tanh函数和softplus函数
  • ¥15 Hadoop集群部署启动Hadoop时碰到问题
  • ¥15 求京东批量付款能替代天诚
  • ¥15 slaris 系统断电后,重新开机后一直自动重启
  • ¥15 QTableWidget重绘程序崩溃
  • ¥15 谁能帮我看看这拒稿理由啥意思啊阿啊
  • ¥15 关于vue2中methods使用call修改this指向的问题