2014-12-03 77 views
0

我有這樣重寫URL 「?客戶=」

abc.com/my-data/customer.php?id=2

一個網址我想這個URL轉換爲

abc.com/my-data/?customer= & ID = 2

有沒有辦法做到這一點?

回答

2

嘗試:

RewriteEngine On 
RewriteCond %{QUERY_STRING} ^id=([0-9]+) 
RewriteRule ^my-data/customer\.php$ /my-data/?customer=&id=%1 [L] 
1

要轉換你需要這個代碼,網址:

RewriteEngine On 
RewriteBase/

# external redirect from actual URL to pretty one 
RewriteCond %{THE_REQUEST} \s/+(my-data)/customer.php\?id=(\d+) [NC] 
RewriteRule^/%1/%2? [R=302,L,NE] 

# internal forward from pretty URL to actual one 
RewriteRule ^(my-data)/(\d+)/?$ $1/customer.php?id=$1 [L,QSA,NC]