2017-09-14 104 views
0

我完全喪失後嘗試和失敗與此小時...重寫和硅石中的子目錄

我有Silex的一個名爲「/後端」目錄中的應用程序。

「domain.com/backend/web」中的silex應用程序工作正常,我需要讓它在「domain.com/backend」中工作。

我有兩個的.htaccess的工作,一個在/後端/後臺等/網絡

這是/後端的的.htaccess:

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase /backend/ 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule^index.php [L] 
</IfModule> 

這是一個在/後端/網絡:

<IfModule mod_rewrite.c> 
    Options -MultiViews 

    RewriteEngine On 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule^index.php [QSA,L] 
</IfModule> 

回答

1

嘗試以下方法:

這是位於/(根)。htaccess的

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteRule ^(.*)$ backend/web/$1 [L] 
</IfModule> 

這是位於/後端的的.htaccess /網絡

<IfModule mod_rewrite.c> 
    Options -MultiViews 
    RewriteEngine On 
    #RewriteBase /path/to/app 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule^index.php [QSA,L] 
</IfModule> 

這應該爲你做的工作!