我想替换aaa中以0x开头的ref参数的任何值。我有这样的链接:domain/test.php?ref=0x1234或domain/test.php?ref=0xABC我想将它们更改为:domain/test.php?ref=aaa .我想使用php中参数ref的值,但我不想使用初始值0x...,我想使用htaccess修改的值aaa
aaa
0x
ref
domain/test.php?ref=0x1234
domain/test.php?ref=0xABC
domain/test.php?ref=aaa
0x...
<?php echo $_GET['ref'] ?>
结果我的代码:aaa
6ovsh4lw1#
我成功的帮助下,从链接后:替换部分查询字符串
RewriteCond %{QUERY_STRING} (.*=)0x(.*) [NC] RewriteRule ^ %{REQUEST_URI}?%1aaa%2 [L] for result: aaa1234 or RewriteCond %{QUERY_STRING} (.*=)0x [NC] RewriteRule ^ %{REQUEST_URI}?%1aaa%2 [L] for result: aaa
@Criss Hass谢谢你,你的建议帮我解决了我的问题。
1条答案
按热度按时间6ovsh4lw1#
我成功的帮助下,从链接后:替换部分查询字符串
@Criss Hass谢谢你,你的建议帮我解决了我的问题。