2015-10-16 90 views
0

我需要重寫這個URL模式的Apache的.htaccess國防部重寫

http://www.example.com/a/b/c/d.php?param=hi 

http://www.example.com/a/b/d.php?type=c&param=hi 

有可能與在.htaccess mod_rewrite的?

非常感謝您的幫助!

[更多信息]

網站的基本URL是http://www.example.com/a/b/,並且我有兩個類型的客戶,私處&賣家。我詢問客戶是否有可能撥打這個網址http://www.example.com/a/b/private/index.php,並用htaccess在內部重寫它,以保留其他GET參數http://www.example.com/a/b/index.php?cust=private

+0

這僅僅是簡單地從一個URL重定向到b網址。也許更多關於你期望發生的信息會有所幫助。它應該重定向還是不等等? –

+0

好的,對不起,我提供了一些細節。網站的基本網址是http://www.example.com/a/b/,我有兩種類型的客戶,私人和賣家。我詢問客戶是否有可能將此網址稱爲http://www.example.com/a/b/private/index.php,並使用htaccess將其內部重寫爲http://www.example.com/a /b/index.php?cust=private保存其他GET參數。 –

回答

0

那麼如果URL總是相同的,你可以直接寫一對一。

RewriteEngine On 
RewriteRule ^a/b/private/index\.php$ /a/b/index.php?cust=private [QSA,L] 
+0

非常感謝!!!! –

0

好的基礎上,巴拿馬傑克的回答這是重寫所有網頁標準的規則,

RewriteEngine On  
RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z_]+)$ $2.php?cust=$1 [QSA]