문제

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top