【问题标题】:Routing error in laravellaravel中的路由错误
【发布时间】:2016-06-02 15:13:55
【问题描述】:

我正在尝试在安装 wamp 服务器的 Windows 平台上的 laravel 5.2 中构建一个 Web 应用程序。

我正在尝试通过以下路线调用仪表板页面:

Route::get('nitsadmin/dashboard', function () {
    return view('nitsadmin.dashboard');
});

以下是路线列表:

我的文件结构如下:

httd-vhosts.conf 文件中我的虚拟主机配置:

<VirtualHost *:80>
    DocumentRoot "c:\wamp\www\nitsedit\public"
    ServerName nitseditor.dev
</VirtualHost>

Apache 别名:

Alias /nitseditor.dev "C:/wamp/www/NitsEdit/public" 

<Directory "C:/wamp/www/NitsEdit/public">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order allow,deny
    Allow from all
 </Directory>

不知道我在哪里遇到问题,但我收到以下错误:

【问题讨论】:

  • 你试过Route::get('/nitsadmin/dashboard', function () { return view('nitsadmin.dashboard'); });吗?
  • @ChoncholMahmud 是的,它抛出了同样的错误。
  • 只需从链接中删除 /public(假设 doc root 已经指向 /public)
  • nitseditor.dev/nitsadmin/dashboard访问然后告诉我发生了什么?
  • @ChoncholMahmud 我收到The request url not found. Apache/2.4.9 (Win64) OpenSSL/1.0.1g PHP/5.5.12 Server at nitseditor.dev Port 80的错误

标签: laravel laravel-5.2 laravel-routing


【解决方案1】:

您的网络服务器配置错误,只需point web server to a public directory in Lararel project root 并重新启动网络服务器。

【讨论】:

  • 每当我输入 nitseditor.dev 时都会出现错误,当我输入 http://nitseditor.dev/nitsadmin/dashboard 时也会显示 localhost 我会收到 The request url not found. Apache/2.4.9 (Win64) OpenSSL/1.0.1g PHP/5.5.12 Server at nitseditor.dev Port 80 的错误
【解决方案2】:

您使用了错误的 URL,放弃“nitsedit\public”部分: http://nitseditor.dev/nitsadmin/dashboard

Apache 已经将用户指向公用文件夹。

【讨论】:

  • 我收到The request url not found. Apache/2.4.9 (Win64) OpenSSL/1.0.1g PHP/5.5.12 Server at nitseditor.dev Port 80的错误
  • 从 apache 配置中删除这一行,认为这可能是冲突的来源: Alias /nitseditor.dev "C:/wamp/www/NitsEdit/"
  • 确保之后重启 apache。
  • hmm .. 好的.. 您之前让服务器正确指向 laravel(该屏幕截图是 laravel),所以也许将该别名指向正确的文件夹会有所帮助?别名 /nitseditor.dev "C:/wamp/www/NitsEdit/public/"
  • 我在文件夹 httpd.confpresent 中的文件夹 apache/conf 中注释掉了 Include conf/extra/httpd-vhosts.conf,它起作用了。
【解决方案3】:

刚刚在文件夹wamp/bin/apache/apache2.4.9/conf 中的文件httpd.conf 中注释掉了Include conf/extra/httpd-vhosts.conf,它就起作用了。

【讨论】:

    猜你喜欢
    • 2015-09-25
    • 1970-01-01
    • 2018-01-18
    • 2016-04-25
    • 2015-06-24
    • 2018-05-31
    • 2018-09-04
    相关资源
    最近更新 更多