2013-09-21 87 views
1

我已經通過stackoverflow.com安靜了一下,但我相信我沒有找到我正在尋找的東西。所以,在這裏。我有一個正確重定向的.htaccess文件,但我有一臺遠程測試服務器,它似乎不像我的開發人員機器那樣重定向,可能這可能是服務器的apache2處理程序配置不正確? 好的,代碼如下。現在.htaccess沒有正確重定向

RewriteRule ^welcome?(.*)     public/index.php [L] 
RewriteRule ^profile?(.*)     public/index.php [L] 
RewriteRule ^password?(.*)     public/index.php [L] 
RewriteRule ^verify(.*)     public/index.php [L] 

RewriteRule ^(.*)$ main.php?%{QUERY_STRING}  [L] 

,在main.php文件能夠處理所有進來,甚至歡迎,概況,密碼,驗證請求。但是現在,我想只將特定文件重定向到public/index.php文件,它在我的開發人員計算機中執行,但在遠程服務器中執行?

+0

您是否在您的測試服務器上的apache中啓用了mod_rewrite?文件public/index.php是否存在? –

回答

4
Options +FollowSymLinks -MultiViews 

RewriteEngine On 
RewriteBase/

RewriteRule ^(welcome|profile|password|verify) public/index.php [NC,L] 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_URI} !^/(welcome|profile|password|verify) [NC] 
RewriteRule ^(.*)$ main.php [QSA,L] 

試試看。