2017-04-11 120 views
0

我是Laravel的新手。我想寫我的路線,不包含根文件夾。這是目前我的路線,其中laravel是我的根文件夾,如何在沒有根文件夾的情況下在Laravel中編寫路線

Route::get('laravel/cars', '[email protected]'); 

,這是我想要的,

Route::get('cars', '[email protected]'); 

下面是我的.htaccess文件

<IfModule mod_rewrite.c> 
<IfModule mod_negotiation.c> 
    Options -MultiViews 
</IfModule> 

RewriteEngine On 

# Redirect Trailing Slashes If Not A Folder... 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)/$ /$1 [L,R=301] 

# Handle Front Controller... 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule^index.php [L] 

# Handle Authorization Header 
RewriteCond %{HTTP:Authorization} . 
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 

回答

1

Laravel的web.php是非常強大的,如果你想這樣的路線然後寫它。它可以是任何

Route::get('/cars', '[email protected]'); 

OR

Route::get('/my/cars', '[email protected]'); 

兩者都是工作能力。試試看。你不需要寫/laravel/

相關問題