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 want redirect all traffic to* to be redirected to*

I found How can I redirect any ServerAlias to the respective ServerName? which handles the topic in question and did what was recommended in the answer with four upvotes:

RewriteEngine On
RewriteCond %{HTTP_HOST}  !^ [nocase]
RewriteRule ^(.*)$$1 [last,redirect=301]

However, this redirect traffic going to to and not to as desired.

Any medication on this issue?

share|improve this question
Your rewrite is ok. Works as intended (tested :). It must be something else with your configuration. – RJS Oct 15 '12 at 16:55
Nope, it's not okay :) – adaptr Oct 15 '12 at 17:17
up vote 2 down vote accepted

The correct way to do this is to create a new vhost and redirect in that:

<VirtualHost *:80>
  Redirect /

<VirtualHost *:80>
  DocumentRoot /var/www/something
share|improve this answer
Thank you so much! This works. – budwiser Oct 15 '12 at 19:14

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.