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.

As i have changed my dynamic urls to static urls. now i have one dynamic url which is already distributed to so many sites. as i dont want to loose traffic whenever anyone trying to access my dynamic url.

My old url is http://www.mysite.com/download.php

i have written a rule in the .htaccess as

Redirect http://www.mysite.com/download.php http://www.mysite.com/download/?page=download

but its not working...

can anyone help me in this regard..

My code :

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
Header set Cache-Control "max-age=2419200, public"

Redirect http://www.mysite.com/download.php http://www.mysite.com/download/?page=download
share|improve this question
Can you paste the entire content of the .htaccess file? Are you sure mod_rerite is enabled? I'm pretty sure that rewrite rule isn't formatted correctly, but I'll let someone else cover that bit. –  EightBitTony May 24 '12 at 11:45
hi thanks for immediate response..here is my code Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / Header set Cache-Control "max-age=2419200, public" Redirect mysite.com/download.php mysite.com/download/?page=download –  phphunger May 24 '12 at 11:47

2 Answers 2

I think you just need,

Redirect /download.php http://www.mysite.com/download/?page=download

This should also work,

Redirect /download.php /download/?page=download

Redirect is provided by mod_alias (thanks pjmorse) so make sure that module is enabled.

share|improve this answer
You do not need the RewriteEngine On or RewriteBase directives for this. The Redirect directive is provided by mod_alias and not mod_rewrite. (But +1 for using Redirect instead of Rewrite.) –  pjmorse May 24 '12 at 13:56
Ah, my bad. Thanks. –  EightBitTony May 24 '12 at 16:16

I believe this should work for what you need to do and redirect from mysite.com/downlo

RewriteEngine On
RewriteCond %{HTTP_HOST} www.mysite.com
RewriteCond %{REQUEST_URI} ^/download/(.*)$
RewriteRule .* http://www.mysite.com/download/?page=download%1 [R]
share|improve this answer
This is going to result in looping redirects. The rule directs the browser to an address which will be matched in the second condition. The first condition is of doubtful necessity. And finally, mod_rewrite is just too much tool: see WhenNotToUseRewrite. –  pjmorse May 24 '12 at 19:16

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.