Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 write my mod_rewrite rules in my .htaccess file to fix the URL that shows up in the browser bar when visitors to to my site. I have a few options that I want my users to be able to enter. They should be able to enter something like:

and it should forward to

where is a URL that I own that's pointing to the site now. I've already got a rule that removes www. from the front of either of those, and I have a rule that will forward to, but if you go to, the URL in the browser bar shows up as

Any suggestions?

share|improve this question
up vote 0 down vote accepted
<IfModule mod_rewrite.c>
  RewriteEngine on

  RewriteCond %{HTTP_HOST} ^(www\.)?(aaa|bbb)\.xxx\.yyy\.edu$ [NC]
  RewriteRule ^(.*)$$1 [L,R=301]
share|improve this answer
Excellent, thanks! – Kyle Oliveira Apr 27 '12 at 17:36

Use Redirect instead:

Redirect Permanent /

Put this inside a vhost that responds to both the hostnames:

<Virtualhost *:80>
 Redirect Permanent /
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.