问题描述
我想是进入我的服务器有额外的%252F字符的URL(由于一些历史原因)和他们(301)重定向到相同的URL没有这些字符赶进来的网址。例如:进来的网址:www.sample.com/content/%252F/foo之后的.htaccess规则:www.sample.com/content/foo
I want to "catch" incoming URLs that enter my server with extra "%252F" characters in the URL (due to some historical reasons) and redirect them (301) to the same url without these characters. For example:incoming url: www.sample.com/content/%252F/fooafter .htaccess rule: www.sample.com/content/foo
我必须要能够赶上这些字符多个实例的URL(在同一个地方),如:www.sample.com/content/%252F/%252F/%252F/foo并删除它们。
I have to be able to catch several instances of these characters in the url (in the same place), like : www.sample.com/content/%252F/%252F/%252F/foo and remove them all.
其中的.htaccess重写规则,我应该使用?
Which .htaccess RewriteRule should I use?
推荐答案
本作品
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)/%2F(.*) /$1$2 [R=301,L]
,但有一个缺点,它确实多个重定向(1每组%252F)
but there is a drawback, it does multiple redirects ( 1 for each group of %252F )
这篇关于如何删除%的EN codeD斜杠使用的.htaccess规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!