duanrenzou1619 2015-07-07 14:22
浏览 45
已采纳

Laravel Routing错误

I'm just getting started with Laravel. I've just installed it. But when I'm making a new route it's not working, it's saying:

The requested URL /laravel/public/test was not found on this server.

This is currently my routes.php:

 Route::get('/', function () {
    >     return view('welcome'); });

    > Route::get('/test', function () {
    >     return view('test'); });

And of course I've made a view called test. When I go to:

http://localhost/laravel/public/test

I'm seeing the Laravel start template. But when I go to:

> http://localhost/laravel/public/test

It's not working?

And why can I also visit:

http://localhost/laravel.dev/

Thankyou.

EDIT:

<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条回答 默认 最新

  • dsgk40568 2015-07-07 14:26
    关注

    I would imagine the issue is with your .htaccess.

    This likely works
    > http://localhost/laravel/public/index.php/test
    

    Now your .htaccess should contain logic to pass all requests to the index.php already by default. If that's the case, then it's likely an issue with your Virtual Host entry not having AllowOverride All within the <Directory> block.

    Note AllowOverride All is not a good choice for a production environment.

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

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度