使用.htaccess删除url中的部分查询

使用.htaccess删除url中的部分查询,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我有以下网址: http://example.com/directory/proc.php?email=a@b、 com&link=http://example.org RewriteEngine on RewriteCond %{QUERY_STRING} ^((.+&)?link=)(https?://)(.+)$ RewriteRule (.*) /$1?%1%4 [NC,L,R] “link”变量中的值将始终具有http://或https://并且我希望将其从url中删除 因此

我有以下网址:

http://example.com/directory/proc.php?email=a@b、 com&link=http://example.org

RewriteEngine on
RewriteCond %{QUERY_STRING} ^((.+&)?link=)(https?://)(.+)$
RewriteRule (.*) /$1?%1%4 [NC,L,R]
“link”变量中的值将始终具有http://或https://并且我希望将其从url中删除

因此,我最终会:


http://example.com/directory/proc.php?email=a@b、 com&link=example.org

下面的代码是否回答了您的问题?
RewriteEngine on
RewriteCond %{QUERY_STRING} ^((.+&)?link=)(https?://)(.+)$
RewriteRule (.*) /$1?%1%4 [NC,L,R]