2015-04-01 53 views
0

我想具體的網址,htaccess的重定向帶參數的URL指定的目錄

http://www.domain.com/com/page.asp?id=99 
to 
https://www.domain.com/de/directory/ 

和所有的URL從

http://www.domain.com/com/page.asp 
to 
https://www.domain.com/de/ 

香港專業教育學院重定向嘗試了一些重定向,但我不能把它做好。 請幫幫我!

RewriteCond %{query_string} id=5 
RewriteRule (.*) https://www.domain.com/de/directory/? [R=301,L] 

this works, but the biggest problem is all urls in the cms https://www.domain.com/cms are redirected too if they contain an id 
+0

看後期編輯。謝謝! – Mike 2015-04-01 14:30:58

+0

'page.asp'之前的'/ com /'是一個真實的目錄嗎? – anubhava 2015-04-01 17:16:19

回答

1

嘗試:

RewriteEngine On 
RewriteCond %{QUERY_STRING} ^id=99$ 
RewriteRule ^page\.asp$ /de/directory/ [L,R] 
RewriteRule ^page\.asp$ /de/ [L,R]