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

What I want to do is the following:

My domain no longer exists. Thus I want to do a simple redirect to the new domain It should be a redirect, that also works when someone types in the browser bar - than it shoul redirect to

I've already tried a few things, but it didn't really work. What do I have to put in the Apache 2 config?

share|improve this question
A late comment. if does not exist anymore meaning there is no ip-adress for, nobody will go anywhere when they type that in the browser. The domain must exist before anyone can go there to be redirected. It's like putting a physical answering machine on your old telephone line giving your new number, then disconnecting the line. – Lenne Jan 7 at 9:37
up vote 24 down vote accepted

You can use the RedirectPermanent directive to redirect the client to your new URL.

Just create a very simple VirtualHost for the old domain in which you redirect it to the new domain:

<VirtualHost *:80>
    RedirectPermanent /
    # optionally add an AccessLog directive for
    # logging the requests and do some statistics
share|improve this answer

Create or edit a .htaccess inside your DocumentRoot. Add

RewriteEngine On
RewriteRule ^(.*)$$1 [R=301,L]

Additionally I would change the ServerName directive to the new domain and leave a ServerAlias with the old domain.

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.