301 redirect will not work with %20 in url
Asked Answered
A

3

6

I am trying to create this redirect:

Redirect /commercial%20work.html http://nataliearriolaphotography.com/fine-art-photography-prints.html

The problem is that when I first created this page I left a space in the file name. In other words it was "/commercial work.html". In chrome and safari the url reads as above with the %20 in place of the space, but when I create this redirect it does not work. I have also tried the following:

Redirect /commercial work.html http://nataliearriolaphotography.com/fine-art-photography-prints.html

This does not work either. It causes a server error page to appear. Does anyone have any suggestions? Thanks!

Airdrome answered 4/1, 2013 at 20:9 Comment(0)
B
24

Try adding quotes. So

Redirect "/commercial work.html" http://nataliearriolaphotography.com/fine-art-photography-prints.html
Bausch answered 4/1, 2013 at 20:11 Comment(8)
Gerben, thanks for the answer, but that doesn't work either. It causes a server error page to appear. Maybe it has something to do with fatcow? Acutally I missed the quotes. Let me try it again! Sorry!Airdrome
@Airdrome what do you mean by fatcow?Toomin
You're welcome. In return, please mark it as answered. Thanks.Bausch
Hi, I am trying t get it work, but this case isn't working with quotes, gives 500 Error (tried multiple variations) RedirectMatch 301 ^/2012 files/(.*)$ /archives/old-website/2012 files/$1Semipalmate
@Semipalmate is the mod_alias module loaded? Also try RedirectMatch 301 ^/2012\ files/(.*)$ /archives/old-website/2012\ files/$1Bausch
@Gerben: I am also troubling with this. Your solution is not working for me. What can issue is? Is there any server issue?Maxa
@VishalChanana You might want to clear your cache and then try again. I had the same issue...Denature
@Bausch What would the Rewrite equivalent be? I tried the Rewrite, but got errors all the time; it wanted to redirect to the root of the server instead of the domain.. not sure why it didn't work...Denature
T
2

Put the page name in quotes should do it, for example:

Redirect 301 "/commercial work.html" http://nataliearriolaphotography.com/fine-art-photography-prints.html
Toomin answered 4/1, 2013 at 20:14 Comment(0)
W
0
RewriteCond %{REQUEST_URI} ^ /commercial\ work.html
RewriteRule ^/(.*) http://nataliearriolaphotography.com/fine-art-photography-prints.html [R=301,L]

try to use escape character to represent the space, it works for me.

Wen answered 17/5 at 6:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.