我在wampserver下安装了带有Composer的Laravel。
我的目录是:C:\wamp/www/lavel/firstProject
公共文件:C:/wamp/www/lavel/firstProject/public
所以当我尝试转到localhost/laraavel/firstProject/public/projects 时
我得到这个错误:"在这个服务器上找不到请求的URL/lavel/index.php。"
当我键入localhost/lavel/firstProject/public/index.php/projects 时,我可以访问
我编辑了httpd.conf并取消了对mod_rewrite
的注释。
将AllowOverride none
更改为AllowOverride all
。
还将RewriteBase /laravel/
添加到.htaccess,然后重新启动,但仍然存在相同的问题。
这是我的routes.php文件:
<?php
// show a static view for the home page (app/views/pages/home.blade.php)
Route::get('/', function() {
return View::make('pages.home');
});
Route::get('about', function() {
return View::make('pages.about');
});
Route::get('projects', function() {
return View::make('pages.projects');
});
Route::get('contact', function() {
return View::make('pages.contact');
});
这是我的htaccess:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /laravel/
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
我知道这个问题被问了很多次,但我尝试了很多提供的解决方案,仍然是一样的。。
谢谢你的帮助或建议。
你试过这个.htaccess吗?
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
它是来自http://laravel.com/docs/4.2/installation#pretty-url
我在.htaccess文件中添加了以下行,它运行良好。
RewriteEngine On
RewriteBase /learn/