简体   繁体   English

使用.htaccess进行301重定向会在url中显示查询字符串

[英]301 redirect with .htaccess shows query string in url

I have a redirect rule in .htaccess . 我在.htaccess有一个重定向规则。

This is the rule: 这是规则:

Redirect 301 /ielts-sat http://www.example.com/ielts-training-in-kuwait

It redirects properly but the result page URL shows as http://www.example.com/ielts-training-in-kuwait?/ielts-sat . 它重定向正确但结果页面网址显示为http://www.example.com/ielts-training-in-kuwait?/ielts-sat

How I remove this query string? 我如何删除此查询字符串?

You can try below rule : 您可以尝试以下规则:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteRule ^ielts-sat$ /ielts-training-in-kuwait? [L,R=301]
</IfModule>

Did you enable the RewriteEngine ? 你启用了RewriteEngine吗? Try above code in different browser. 在不同浏览器中尝试以上代码。

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

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