将 PHP get 变量重写为另一个 get 变量


rewrite php get variable to another get variable

>我最近更改了我的网站源代码,一切都经过测试并按预期工作,但我有许多来自其他地方的遗留链接,我想重定向。

我的旧网站使用了类似的链接

mypage.php?id=abc123

我需要这个重定向到

mypage.php?user=abc123

感谢任何可以帮助我尝试不同事情但无法弄清楚的人

我本来会更改 php 文件中的 $_GET 变量,但它是加密的

你会在你的.htaccess文件中使用这样的东西

RewriteEngine On
RewriteBase /
RewriteRule  ^mypage'.php'?id=(.*)$ mypage.php?user=$1 [L,R=301]