0

I'm trying to redirect URLs and can't get anything to work. Here is what I'm hoping to do:

Old URL:

www.example.com/asp.pl?_puri=astore.amazon.com%2Fthegi02-20%2Fdetail%2FB0001L0DFA%2Fassid

Needs to redirect to:

www.example.com

Anyone know of any way to do that? If you can figure it out I can send over a $25 PayPal payment. I need it quick.

  • Welcome to Serverfault, Steve. You'll need to tell us more, I'm afraid. What programming language is your site in -- .pl could mean Perl, is that true? You have access to the asp.pl script, I presume? Or if you don't have access to the script, do you have access to the server? Which webserver is it, Apache or Microsoft IIS, which version? –  Sep 24 '09 at 16:57
  • What are you working with? Apache? IIS? – RainyRat Sep 24 '09 at 16:58

2 Answers2

1

Try this:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^_puri=astore.amazon.com%2Fthegi02-20%2Fdetail%2FB0001L0DFA%2Fassid$
RewriteRule ^asp\.pl$ http://www.example.com/ [L,R=301]

And if you also want to check the host name, add RewriteCond %{HTTP_HOST} =www.example.com to the rule.

Gumbo
  • 436
  • 2
  • 6
0

You don't mention anything about your environment. From the .pl file extension I assume that you are using Perl, but I have no idea which webserver you are using.

If the file asp.pl does not exist, you can create a custom 404 error page to do the redirect. If you are using IIS, this can be accomplished using the IIS management tools.

If the file asp.pl exists, the redirect will have to happen as part of the Perl script in asp.pl, or via some URL rewrite scheme that understands what is and is not valid. If you are using Apache this can be accomplished using .htaccess files. In IIS you may have to insert an ISAPI rewrite module into the server processing stack. For information on doing a redirect in Perl, check this post on perlmonks.

You didn't mention if there were certain query strings that were valid and some that were invalid and should be redirected.

A little more information is required to fully answer your question.

user21034
  • 171
  • 6