This is a discussion on Redirect URL that contains %20 within the Apache Web Server forums, part of the Web Server and Related Forums category; Hello, I need to redirect a legacy URL to a new URL. The legacy URL is similar to: http://www....
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hello,
I need to redirect a legacy URL to a new URL. The legacy URL is similar to: http://www.foo.com/testing/old%20web%20page.htm I've tried to use a Redirect with /testing/old%20web%20page.htm, but Apache (2.0.52) doesn't seem to recognize it. I've also tried a few variations with the RedirectMatch directive, but I can't seem to find a working regexp. I thought the following might work, but I'm also a little rusty on my regexps. RedirectMatch ^/testing/old\.*?page.htm$ Any ideas? Mike K. |
|
|||
|
mail4mike@gmail.com wrote:
> Hello, > > I need to redirect a legacy URL to a new URL. The legacy URL is > similar to: > http://www.foo.com/testing/old%20web%20page.htm > I've tried to use a Redirect with /testing/old%20web%20page.htm, but > Apache (2.0.52) doesn't seem to recognize it. > > I've also tried a few variations with the RedirectMatch directive, but > I can't seem to find a working regexp. I thought the following might > work, but I'm also a little rusty on my regexps. > RedirectMatch ^/testing/old\.*?page.htm$ Lose the \ before the ., it makes it a literal. Isn't %20 converted back to spaces before it enters the rewriteengine? Grtz, -- Rik Wasmus |
|
|||
|
Not sure about how Apache treats %20, but your regexp correction worked
perfectly. My URL is redirecting correctly now. Thank you, Mike K. Rik wrote: > mail4mike@gmail.com wrote: > > Hello, > > > > I need to redirect a legacy URL to a new URL. The legacy URL is > > similar to: > > http://www.foo.com/testing/old%20web%20page.htm > > I've tried to use a Redirect with /testing/old%20web%20page.htm, but > > Apache (2.0.52) doesn't seem to recognize it. > > > > I've also tried a few variations with the RedirectMatch directive, but > > I can't seem to find a working regexp. I thought the following might > > work, but I'm also a little rusty on my regexps. > > RedirectMatch ^/testing/old\.*?page.htm$ > > Lose the \ before the ., it makes it a literal. > Isn't %20 converted back to spaces before it enters the rewriteengine? > > Grtz, > -- > Rik Wasmus |