简体   繁体   English

包含查询字符串的URL,从.htaccess重定向301失败

[英]url including query string, redirect 301 from .htaccess fail

I would like to redirect 我想重定向

to

I tried to redirect as follow but it always lead me to 404 page 我尝试按照以下方式进行重定向,但它始终将我引导至404页

 RewriteCond %{QUERY_STRING} ^$
 RewriteRule ^aboutus/details\.php /about-us [R=301,NC,NE,L]

Also I tried Redirect 301 as follow but also lead me to 404 not found page 我也尝试了Redirect 301 ,但也导致我进入404找不到页面

Redirect 301 /aboutus/details.php?target=indonesia   https://www.example.com/about-us

Any idea about this one? 对这个有任何想法吗? I was finding this problem for almost 2 days :( And i am using Joomla ! 我已经将近2天的时间发现了这个问题:(而且我正在使用Joomla!

You need to match against the query string then redirect the request to remove those query strings using ? 您需要与查询字符串匹配,然后使用重定向请求以删除那些查询字符串 :

Try : 尝试:

RewriteCond %{THE_REQUEST} /aboutus/details\.php\?target=indonesia [NC]
RewriteRule ^ /about-us? [L,R]
 RewriteRule ^about-us/?$ /aboutus/details.php?target=indonesia [NC,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM