【问题标题】:laravel 5 routing in working app folder other than the examples that use the default 127.0.0.1 root除了使用默认 127.0.0.1 根目录的示例之外,工作应用程序文件夹中的 laravel 5 路由
【发布时间】:2015-07-27 10:01:43
【问题描述】:

我试图了解 laravel 5 路由 bt 它让我头疼。我在我的 routes.php 中使用 vagrant.am 我有以下内容:

  Route::get('/about','RoutingController@index');
    Route::controllers ( [ 
        'auth' => 'Auth\AuthController',
        'password' => 'Auth\PasswordController' 
    ] );

然后在我的控制器中我有

namespace App\Http\Controllers;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class RoutingController extends Controller {
    public function index() {
        return 'This is all about Asiago !';
    }
}

我的应用位于http://192.168.33.10/Php-Projects/laravel 当我导航到http://192.168.33.10/Php-Projects/laravel/public/about 路径时。 404 error 出现。

【问题讨论】:

    标签: php html laravel


    【解决方案1】:

    您需要在 Apache 中设置一个指向公共目录的虚拟主机...

    <VirtualHost *:80>
        ServerName laravelproject.dev
        DocumentRoot /path/to/laravel/public/folder
    </VirtualHost>
    

    在您的 hosts 文件中将 laravelproject.dev 指向 192.168.33.10

    然后浏览到http://laravelproject.dev/about

    【讨论】:

    • 不能只使用我目前拥有的这条路径吗?
    • 它无法识别路径... /about != /Php-Projects/laravel/public/about
    • 我在过去的 2 个月里一直在寻找解决方案,包括 laravel 食谱,但到目前为止没有答案。有没有人可以带我通过这个请我的代码默认“/” URL 正在工作,但whendocapp.com/about 给出 404 错误
    【解决方案2】:

    我得到了解决方案
    1. 在 wamp 中制作vhost 2. 在 wamp 中转到托盘图标 apache&gt;apache modules 滚动并检查 rewrite_module

    【讨论】:

      猜你喜欢
      • 2016-06-23
      • 2018-09-29
      • 2015-04-25
      • 1970-01-01
      • 2018-10-21
      • 2014-03-25
      • 1970-01-01
      • 2015-08-15
      • 1970-01-01
      相关资源
      最近更新 更多