Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Here's what I'd like to do:

If a user goes to www.example.com/thislocation, I'd like to redirect to a particular script and give it "thislocation" as a parameter.

So if a user navigated to www.example.com/thislocation, I'd like to redirect to www.example.com/cgi-bin/test.pl?parameter=thislocation, and similarily, if the user navigated to www.example.com/thatlocation, I'd like to redirect to www.example.com/cgi-bin/test.pl?parameter=thatlocation.

Is this possible with Apache?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You could achieve this by using .htaccess and the code for this is:

RewriteEngine on
RewriteRule ^(.*)$ /cgi-bin/test.pl?parameter=$1 [L] 
share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.