htaccess将带参数的URL重定向到特定目录

时间:2015-04-01 14:16:44

标签: apache .htaccess redirect web

我想从

重定向特定的网址
http://www.domain.com/com/page.asp?id=99
to
https://www.domain.com/de/directory/

以及来自

的所有网址
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

1 个答案:

答案 0 :(得分:1)

尝试:

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