You can use this rule to remove +
from anywhere in an URI:
RedirectMatch 301 ^/(.+?)\+(.*)$ /$1$2
题
My URL is: www.domain.com/url/url/+
I want redirect a 301
error to www.domain.com/url//url/
I've tried this method does not work:
RedirectMatch 301 /+(.*)$ http://www.domain.com/$1
nor does:
RedirectMatch 301 /(.*)/(.*)/+(.*) http://www.domain.com$1
What method could I use? To cut the +
in www.domain.com/url/+
to make it show www.domain.com/url
?
解决方案
You can use this rule to remove +
from anywhere in an URI:
RedirectMatch 301 ^/(.+?)\+(.*)$ /$1$2
其他提示
Hence RedirectMatch uses Regex, + is ment for one or more of the char infront of it. You should use + instead.
The +
needs to be escaped because it's a reserved character for "one or more":
RedirectMatch 301 ^/(.*)\+ http://www.domain.com/$1