【发布时间】:2021-12-24 15:57:48
【问题描述】:
如果存在特殊参数,我正在尝试重写任何 URL。
这样会发生:
发件人:www.example.com/somepage/someother/?entryValue=somevalue
收件人:www.example.com/somepage/someother/?product=test&special=12345ls&linkSource=website
我尝试跟随,但它没有按预期工作:
此代码添加 var/www/* 而不是链接
www.example.com/var/www/web6/htdocs/example.com/index.php/*
RewriteCond %{QUERY_STRING} (^|&)entryValue=somevalue
RewriteRule ^(.*)$ $1/?product=test&special=12345ls&linkSource=website [L,R]
这段代码删除了路径:
RewriteCond %{QUERY_STRING} (^|&)entryValue=somevalue
RewriteRule ^(.*)$ /?product=test&special=12345ls&linkSource=website [L,R]
我怎样才能让它工作?
【问题讨论】:
-
感谢您分享您的努力,您能否更清楚地说明您要从哪个网址重定向到哪个网址?
-
URL 应该保持不变,只是 get 参数应该改变,如果 URL 有参数 (entryValue=somevalue)。然后页面应该使用新参数重新加载。
-
能否请您以这样的形式提及:FROM
http://localhost:/test/etc/testTOhttp://localhost/someting else here..,以便我们更好地理解它,因为您在问题中提到的网址看起来不太清楚,谢谢。 -
我想要这个:如果这个链接在没有 get var 的情况下打开,什么都不会发生:localhost:/test/etc/test 但是如果链接包含:localhost:/test/etc/test?entryValue=somevalue get var 应该变成这样:localhost:/test/etc/…跨度>
-
你的意思是你点击链接
www.example.com/somepage/someother需要重定向到localhost:/test/etc/testurl?请务必在此表格中提及以澄清要求。
标签: .htaccess redirect mod-rewrite get