Php 找不到此服务器上找不到请求的URL/about。拉维尔航线
我说了一个错误 找不到 在此服务器上找不到请求的URL/about 我有这条路线Php 找不到此服务器上找不到请求的URL/about。拉维尔航线,php,laravel,laravel-5,wamp,wampserver,Php,Laravel,Laravel 5,Wamp,Wampserver,我说了一个错误 找不到 在此服务器上找不到请求的URL/about 我有这条路线 Route::get('/', 'megamitch@index'); Route::get('home', 'megamitch@index'); Route::get('about', 'megamitch@about'); Route::get('loan-products', 'megamitch@loanproducts'); Route::get('careers', 'megamitch@career
Route::get('/', 'megamitch@index');
Route::get('home', 'megamitch@index');
Route::get('about', 'megamitch@about');
Route::get('loan-products', 'megamitch@loanproducts');
Route::get('careers', 'megamitch@careers');
Route::get('contact', 'megamitch@contact');
如果我使用“php artisan路由:列表”,我可以看到这些路由确实存在。我在wamp服务器上运行这个问题(在live web服务器上也是这个问题),但是如果我通过“php artisan Service”运行我的应用程序,所有页面都会工作。有什么想法吗,帮帮我
PS:仅此路由“路由::获取('/',”megamitch@index“);”有效。听起来你的重写好像不起作用。如果将
index.php
添加到/about
之前的URL中,它是否有效
例如,yourdomain.com/about
将变成yourdomain.com/index.php/about
如果重写不起作用,但您的public
目录中有.htaccess
文件,那么您可能需要在apache配置中允许重写。下面是WAMP和Laravel的虚拟主机配置示例
我已经标记了你需要更改的行。将第一个和第三个更改为指向网站目录中的public
目录。然后将第二行更改为您在网站上使用的域名
<VirtualHost *:80>
DocumentRoot "C:/wamp/www/yourdomain/public" # Change this line
ServerName yourdomain.com # Change this line
<Directory "C:/wamp/www/yourdomain/public"> # Change this line
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All # This line enables .htaccess files
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
DocumentRoot“C:/wamp/www/yourdomain/public”#更改此行
ServerName yourdomain.com#更改此行
#换行
选项索引如下SYMLINKS ExecCGI包括
AllowOverride All#此行启用.htaccess文件
命令允许,拒绝
通融
您需要重新启动Apache才能使这些设置生效。关于
/index.php/about
有效吗?如果是这样,那么您的apache配置不会重写url。是的,它可以工作,我将如何配置apache配置以便它重写url或有什么修复方法?我缺少一个解决问题的/pulic/httaccess。这个解决方案(为虚拟主机启用mod_rewrite)对我有效: