evangelion3258
evangelion3258

Reputation: 77

301 redirect will not work with %20 in url

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!

Upvotes: 6

Views: 11946

Answers (3)

Yvonne
Yvonne

Reputation: 53

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.

Upvotes: 0

Ayman Farhat
Ayman Farhat

Reputation: 2080

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

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

Upvotes: 2

Gerben
Gerben

Reputation: 16825

Try adding quotes. So

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

Upvotes: 24

Related Questions