重定向到使用.htaccess和参数修改的URL

oxf4rvwz  于 2023-03-23  发布在  其他
关注(0)|答案(1)|浏览(112)

我对htaccess不太熟悉,我现在的网址是:https://example.com/wp-admin/https%3A%2F%2Fexample.com%2F?latepoint_booking_intent_key=e9176adf75c89661f6ca但我想这被重定向到https://example.com/?latepoint_booking_intent_key=e9176adf75c89661f6ca .我如何才能做到这一点与.htaccess?
我试过了

RewriteEngine on

RewriteRule  ^wp-admin/https%3A%2F%2Fexample.com%2F/?$ ?latepoint_booking_intent_key=$1  [R=301,L,NC]

但是,新的URL是:
https://example.com/wp-admin/https://example.com/?latepoint_booking_intent_key=e9176adf75c89661f6cc,不正确
请问有没有.htaccessMaven可以帮我

yrwegjxp

yrwegjxp1#

使用RewriteCond指令匹配URL中的查询字符串:

RewriteEngine On

RewriteCond %{REQUEST_URI} ^/wp-admin/https%3A%2F%2Fexample.com%2F$
RewriteCond %{QUERY_STRING} ^(latepoint_booking_intent_key=.+)$
RewriteRule ^(.*)$ /?%1 [R=301,L]

Test

相关问题