Domanda

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?

È stato utile?

Soluzione

You can use this rule to remove + from anywhere in an URI:

RedirectMatch 301 ^/(.+?)\+(.*)$ /$1$2

Altri suggerimenti

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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top