laravel项目的当前文件夹结构是
local
---app
---bootstrap
---vender
index.php
.htaccess
我的app.php在app文件夹中
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');
});
这是根文件夹中的.htacess文件
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
我的主要项目位于localhost / laravel。它显示所有菜单,但
当我点击关于菜单或其他菜单项目重定向到localhost / project或localhost / about时。 它的工作类型是手动url,如localhost / laravel / project或localhost / laravel / about等
答案 0 :(得分:0)
试试这个:
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ laravel/$1 [L,R=301]