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 to redirect my subdomain to an internal URL.

For example when user types in he should see a homepage

but when is typed in I'd like to open

How to achieve this?

I already tried with:

<VirtualHost *:8089>
    DocumentRoot "c:\app"

<VirtualHost sms.localhost:8089>
    ServerName smslocalhost
    Redirect permanent / http://localhost:8089/testpage

Problem is that whatever I type in now, I get redirected to http://localhost:8089/testpage

share|improve this question

I'm not sure your first vhost definition is doing anything so everything is being processed by the second definition. Try

<VirtualHost *:8089>
    ServerName localhost
    DocumentRoot "c:\app"

<VirtualHost sms.localhost:8089>
    ServerName sms.localhost
    Redirect permanent / http://localhost:8089/testpage

EDIT: From the comments.

NameVirtualHost *:8089

fixed the problem.

share|improve this answer
Thanks for your reply. I tried this already. First definition had "ServerName localhost" and the second one had "ServerName sms.localhost". It didn't work. – Goran Jul 21 '11 at 9:36
You did remember to put an entry for sms.localhost in your %WINDIR%\System32\drivers\etc\hosts file didn't you? – Iain Jul 21 '11 at 9:47
Yes. " sms.localhost" – Goran Jul 21 '11 at 9:50
@Goran: I just tested the exact configuration above on a wamp server and it works exactly as you want. – Iain Jul 21 '11 at 10:26
When I added NameVirtualHost *:8089 everything started working. – Goran Jul 21 '11 at 11:06

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.