CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Apache configuration (http://www.codingforums.com/forumdisplay.php?f=69)
-   -   .htaccess redirect not workign when %20 is in old url (http://www.codingforums.com/showthread.php?t=134799)

zenweezil 03-07-2008 02:28 AM

.htaccess redirect not workign when %20 is in old url
 
I am redesigned a site and setting up the .htaccess 301 redirects and noticed the old urls with spaces (%20) in them will not redirect.

All the others are redirecting correctly. Here is an example of one that won't work:

Redirect 301 /contact%20us.htm http://www.mynewsite.com/contact.php



Thoughts?

oesxyl 03-07-2008 03:05 AM

Quote:

Originally Posted by zenweezil (Post 663517)
I am redesigned a site and setting up the .htaccess 301 redirects and noticed the old urls with spaces (%20) in them will not redirect.

All the others are redirecting correctly. Here is an example of one that won't work:

Redirect 301 /contact%20us.htm http://www.mynewsite.com/contact.php

Thoughts?

try this:

Code:

Redirect 301 http://www.mynewsite.com/contact\ us.htm http://www.mynewsite.com/contact.php
or better use this:
Code:

RewriteRule ^contact\ us\.htm$ http://www.mynewsite.com/contact.php [R=301,L]
:
best regards

zenweezil 03-07-2008 03:20 AM

Neither of those worked. The first one caused an error - even when I removed the full url in the first reference. The second just didn't redirect.

_Aerospace_Eng_ 03-07-2008 03:52 AM

This should work
Code:

Redirect 301 "/contact us.html" http://www.mynewsite.com/contact.php

zenweezil 03-07-2008 03:58 AM

WE HAVE A WINNER!! Thank you that worked perfectly!


Quote:

Originally Posted by _Aerospace_Eng_ (Post 663525)
This should work
Code:

Redirect 301 "/contact us.html" http://www.mynewsite.com/contact.php


brandonb 01-12-2011 05:48 PM

Option that Worked Also
 
I was running into the same problem. This is the solution that worked for me on http://www.mycollegesandcareers.com which we're running on an Ubuntu server.

Code:

redirectMatch 301 ^/careers[\s]/(.*)$ http://www.mycollegesandcareers.com/careers/$1
the whole [\s] is regular expression for any whitespace. It's the only thing that would work for me. I couldn't get any of the suggested stuff above to work.

Hope this helps someone else that is in the same boat as I was.


All times are GMT +1. The time now is 09:14 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.