简体   繁体   English

htaccess 重写并将 url 从字符 %26 重定向到 &

[英]htaccess rewrite and redirect url from character %26 to &

I have a following URL and it works perfectly like the following:我有一个以下 URL,它的工作原理如下:

http://www.naturaflowers.com/garland-&-wreaths/garland.html

Now google webmaster crawl the site and fetch the same URL in two format like the following and show duplicate error现在谷歌网站管理员抓取网站并以如下两种格式获取相同的网址并显示重复错误

http://www.naturaflowers.com/garland-&-wreaths/garland.html
http://www.naturaflowers.com/garland-%26-wreaths/garland.html

Now I want to redirect %26 to & character so that it will not show the duplicate in google web master.现在我想将 %26 重定向到 & 字符,这样它就不会在谷歌网站管理员中显示重复项。 Please help me to overcome this issue.请帮助我克服这个问题。 Thanks.谢谢。

Try:尝试:

RewriteCond %{THE_REQUEST} /garland-%26-wreaths/garland.html
RewriteRule ^(.*)garland-&-wreaths/garland.html$ /$1garland-&-wreaths/garland.html [L,R=301]

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

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