Welcome to WebmasterWorld Guest from 54.196.244.45

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

301 Redirect for removed dynamic page

     
6:05 am on Sep 28, 2006 (gmt 0)

New User

10+ Year Member

joined:Nov 24, 2004
posts:37
votes: 0


Hi JD;

I have been reading / testing / pulling hair for hours and cannot get this simple thing to work...

We've taken over an old site that had an affiliate program. Google Sitemaps is telling us there have been several 404s to www.oursite.com/default.asp?AffID=#### (default.asp does not exist any more)- I would like to redirect these to www.oursite.com/newaffiliate-signup/

I've tried everything and can almost get it to work, but usually get the?AffID=### appended to the new url.

This was the closest thing I could find that resembled our situation, but it does not work at all:
RewriteRule ^default.asp?AffID=(.*)$ /newaffiliate-signup/ [L,R=301]

What am I doing wrong?

Thanks in advance.

6:13 am on Sept 28, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 15, 2002
posts:6807
votes: 0


You need to check for the query string separately.

RewriteCond %{REQUEST_URI} ^/default.asp$
RewriteCond %{QUERY_STRING} ^(.*&)AffID=####(&.*)$
RewriteRule ^.*$ /newaffiliate-signup/ [L,R=301]

[edited by: DrDoc at 6:14 am (utc) on Sep. 28, 2006]

2:25 pm on Sept 28, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


Another way to do it would be:

RewriteCond %{QUERY_STRING} &?AffID=[^&]* [NC]
RewriteRule ^default\.asp$ http://www.example.com/newaffiliate-signup[b]/?[/b] [R=301,L]

You'll need the question mark at the end of the substitution URL to clear the current query string.

I'm not sure about redirecting to the aff signup page, though. You may end up redirecting visitors who follow an affiliate link to the signup page. If that's not what you want, just change the substitution URL.

Jim

3:36 pm on Sept 28, 2006 (gmt 0)

New User

10+ Year Member

joined:Nov 24, 2004
posts:37
votes: 0


Thanks Jim;

Worked like a charm. Also thanks for the heads up about affiliate links... I never thought of that.

Regards,

Paul