如何使用.htaccess重命名或修改部分查询字符串

如何使用.htaccess重命名或修改部分查询字符串,.htaccess,.htaccess,我需要 去 http://somehost.com/?p=whatever&nothis=somevar 只是想把查询的“Nothins”部分改为“this” 一直在敲我的头,我想不出来 我需要在这里上一课。非常感谢。尝试将其添加到文档根目录中的htaccess文件中: http://somehost.com/?p=whatever&this=somevar RewriteEngine On RewriteCond %{QUERY_STRING} ^(.*)nothis=so

我需要

http://somehost.com/?p=whatever&nothis=somevar
只是想把查询的“Nothins”部分改为“this”

一直在敲我的头,我想不出来


我需要在这里上一课。非常感谢。

尝试将其添加到文档根目录中的htaccess文件中:

http://somehost.com/?p=whatever&this=somevar
RewriteEngine On
RewriteCond %{QUERY_STRING} ^(.*)nothis=somevar(.*)$
RewriteRule ^(.*)$ /$1?%1this=somevar%2 [L]