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.

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

报告相同问题?

悬赏问题

  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行