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 have my blog running at a server with ip real).

There is only one virtual host for this blog on the server.

Here is the apache configuration:

VirtualHost star:80
DocumentRoot /var/www/
RewriteEngine on
RewriteCond %{HTTP_HOST} ^[^.]$
RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
RewriteRule ^([^.]+)*) /var/www/$1
DirectoryIndex index.php

Directory /var/www/ AllowOverride All
Order Deny,Allow
Allow from all

My DNS is pointing to this ip address .

When I load first time it loads correct with no problems. But whenever i click a link it shows url like etc.

I am a newbie. Please help me set up this.
Is there any problem with the rewrite rule ?

share|improve this question

The problem is the application generating URLS seems to be creating absolut URIs which your server is unable to handle because of your Server Configuration.

There are two possible solutions which come to mind:

Configure the Application correctly so it either creates relative URIs or if really needed absolute URIs with the correct host.

The dirty solution would be to put a ServerAlias directive in place to handle this:


It would be possible but not advisable to solve the problem with mod_rewrite as well. But this so terrible style I won't explain it.

share|improve this answer
Thanks pacey for the reply. There was problem with the application. Application was changing to ip address. Also mod rewrite is not required in this configuration. – Champion Dec 9 '10 at 13:25

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.