使用参数

时间:2019-05-31 19:06:51

标签: .htaccess url-rewriting

我想重写此URL:

https://example.com/forms/cus_F8fylX6aITpJOR

https://example.com/assets/forms/redirect.php?id=cus_F8fylX6aITpJOR

这是我尝试过的:

RewriteCond %{QUERY_STRING} id=(\w+) [NC]
RewriteRule ^assets/forms/redirect.php?id=$1 [L]

我的错误在哪里?

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

这是您需要的:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^forms/([^/]+) /assets/forms/redirect.php?id=$1 [QSA,L]