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

htaccess redirect urls with parameters to specific directory

我想重定向来自

的特定网址
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

尝试:

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