2014-01-18 203 views
1

嘗試配置整個重定向業務讓人非常沮喪。我有laravel作爲主根目錄的子目錄。因此,而不是這樣做:Laravel 4子目錄的HTAccess

Route::get('/game/quiz/', '[email protected]'); 
Route::get('/game/quiz/home', '[email protected]'); 
Route::get('/game/quiz/boho', '[email protected]'); 
Route::get('/game/quiz/chic', '[email protected]'); 
Route::get('/game/quiz/elegant', '[email protected]'); 
Route::get('/game/quiz/glamour', '[email protected]'); 
Route::get('/game/quiz/quirky', '[email protected]'); 
Route::post('/game/quiz/submitQuiz', '[email protected]'); 

^^導致404對所有的公共資產

我非常想要這個:

Route::get('/', '[email protected]'); 
Route::get('home', '[email protected]'); 
Route::get('boho', '[email protected]'); 
Route::get('chic', '[email protected]'); 
Route::get('elegant', '[email protected]'); 
Route::get('glamour', '[email protected]'); 
Route::get('quirky', '[email protected]'); 
Route::post('submitQuiz', '[email protected]'); 

這是我主要的應用程序的htaccess:

<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteRule (.*) public/$1 [L] 
</IfModule> 

指向公共文件夾,這是很好的。

現在公用文件夾的htaccess:

<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] 

$ _ SERVER當我DD();

["REQUEST_URI"] "/game/quiz/" 
["CONTEXT_DOCUMENT_ROOT"] "/home/sites/mywebsite.co.uk/public_html/" 
["SCRIPT_FILENAME"] "/home/sites/mywebsite.co.uk/public_html/game/quiz/public/index.php" 
["SCRIPT_URI"] "http://mywebsite.co.uk/game/quiz/" 

幫助將不勝感激!

回答

1

路徑是文件配置/bootstrap/paths.php

加/遊戲/測驗,在該文件中定義的所有路徑。如果使用相對於文件夾引導程序的絕對路徑或路徑正確配置,那麼您將解決您的問題。

+0

我沒有這個文件在L5.1,我該怎麼做? – OskarD90