2013-07-09 47 views
0

我使用WHMCS-WP系統集成商和需要自定義的網址,我在WordPress的.htaccess文件重寫URL,但它不工作的.htaccess重定向不WordPress的工作與WHMCS-WP集成

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase /test/ 
RewriteRule ^billing/client-area/$ /billing/?whmcsportal%5Bpage%5D=whmcs%3A%2F%2Fwww.thesmarttech.com%2Fclientarea.php 
</IfModule> 

我目前的網址是

http://www.thesmarttech.com/test/billing/?whmcsportal%5Bpage%5D=whmcs%3A%2F%2Fwww.thesmarttech.com%2F 

,我想它rewite到

http://www.thesmarttech.com/test/billing/client-area/ 

回答

0

有幾件事情:

  1. 您需要刪除規則目標中的前導斜槓。它將被解釋爲一個絕對的URL路徑,並且不會使用URI基址
  2. 您必須在目標中使用%進行轉義(使用反斜槓)。 mod_rewrite的的去解釋這些作爲反向引用
  3. 您需要使用NE標誌,使%的沒有得到編碼:


<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase /test/ 
RewriteRule ^billing/client-area/$ billing/?whmcsportal\%5Bpage\%5D=whmcs\%3A\%2F\%2Fwww.thesmarttech.com\%2Fclientarea.php [L,NE] 
</IfModule> 

此外,還要確保這些規則位於/test/目錄中的htaccess文件中。

+0

它仍然不能正常工作...它給出的頁面沒有找到錯誤。當我編寫RewriteRule^billing/client-area/$ billing /?whmcsportal \%5Bpage \%5D = whmcs時,您可以訪問http://www.thesmarttech.com/test/billing/client-area/查看錯誤 –

+0

\%3A \%2F \%2Fwww.thesmarttech.com \%2Fclientarea.php [R = 301,L,NE],它工作正常,但當我刪除R = 301它給404錯誤 –