Welcome to WebmasterWorld Guest from 174.129.127.214

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Problem with a simple htaccess 301 redirect

there is a quote mark in the referring url

   
4:05 am on Mar 10, 2008 (gmt 0)

5+ Year Member



Hello again web master world.

I have just launched a site and it seems some doofus has linked to a non existent page on my site.

It's interesting because the link contains old text and a url with keywords in it from the article on the site. The page itself hasn't been indexed into an SE's yet. Odd.

So here is my current quandary.

I am getting a link to my site that looks like this.

http://www.example.com/fakedir/Keyword's from the article on my site.htm

and i would like to redirect it here

http://www.example.com/realdir/the-actual-article-on-my-site

so i would think it would be as simple as

Redirect /fakedir/Keyword's%20from%20the%20article%20on%20my%20site.htm http://www.example.com/realdir/the-actual-article-on-my-site

It's just not working. Is there a correct way to do this?

thanks in advance :)

edit: also i should add that none of these directory's actually exist but are being created with mod rewrite. I would be working with the home directory htaccess.

[edited by: tedster at 8:40 pm (utc) on Mar. 27, 2008]
[edit reason] switch to example.com - it cannot be owned [/edit]

4:29 am on Mar 10, 2008 (gmt 0)

5+ Year Member



Sorry for the bother. To other apache newbs like me, the solution is to put the string to be redirected in to double quotes and remove the url encoding.

so the redirect command that worked for me is:

Redirect "/fakedir/Keyword's from the article on my site.htm" http://example.com/realdir/the-actual-article-on-my-site

i hope this save some one a few more minutes then I have just spent learning that simple lesson.

[edited by: tedster at 8:40 pm (utc) on Mar. 27, 2008]

12:38 am on Mar 11, 2008 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



You could pro-actively redirect more URLs with less work, if you use Mod-Rewrite code.

RewriteRule fakedir http://www.example.com/realdir/the-actual-article-on-my-site [R=301,L]