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.

www.source.com should be redirected to www.destination.com

but www.source.com/mypage.html should not be redirect, it should still navigate to www.source.com/mypage.html

I tried this

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) www.destination.com/$1 [R=301,L]

when I accessed www.source.com/mypage.html, it displays page not found as there is no page www.destination.com/mypage.html.

How can I achieve this redirection?

share|improve this question

1 Answer 1

up vote 3 down vote accepted
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?source\.com$ [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ http://www.destination.com/ [R=301,L]
share|improve this answer
source.com, www.source.com, http://www.source.com all should be redirected. How to achieve this? –  Tech Jerk Oct 12 '11 at 7:17
Check out my updated answer. –  quanta Oct 12 '11 at 7:31

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.