使用 htaccess 将 www.url.com/x=y 重定向到 www.url.com/file.php?x=y?

Redirect www.url.com/x=y to www.url.com/file.php?x=y with htaccess?

我意识到这个问题的结构确实很糟糕,但这就是我问它的原因;我不知道如何在 google.

中输入

我要重定向:

www.url.com/x=2

至:

www.url.com/file.php?x=2

使用这个

 Redirect 301 /x=2 www.url.com/file.php?x=2

编辑

如果您需要批量重定向一组链接,您可能需要使用 RedirectMatch 指令。

RedirectMatch ^/x=(.*)$ /file.php?x=