Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

Old URL:

Needs to redirect to:

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.

share|improve this question
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 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? – Jesper Mortensen Sep 24 '09 at 16:57
What are you working with? Apache? IIS? – RainyRat Sep 24 '09 at 16:58

Try this:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^asp\.pl$ [L,R=301]

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

share|improve this answer

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 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 exists, the redirect will have to happen as part of the Perl script in, 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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.