0

Helo,

I want to redirect my subdomain to an internal URL.

For example when user types in someaddress.com he should see a homepage

but when xxx.someaddress.com is typed in I'd like to open http://someaddress.com/testpage

How to achieve this?

I already tried with:

<VirtualHost *:8089> DocumentRoot "c:\app" </VirtualHost> <VirtualHost sms.localhost:8089> ServerName smslocalhost Redirect permanent / http://localhost:8089/testpage </VirtualHost> 

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

1 Answer 1

1

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> <VirtualHost sms.localhost:8089> ServerName sms.localhost Redirect permanent / http://localhost:8089/testpage </VirtualHost> 

EDIT: From the comments.

NameVirtualHost *:8089 

fixed the problem.

5
  • 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. Commented Jul 21, 2011 at 9:36
  • You did remember to put an entry for sms.localhost in your %WINDIR%\System32\drivers\etc\hosts file didn't you? Commented Jul 21, 2011 at 9:47
  • Yes. "127.0.0.1 sms.localhost" Commented Jul 21, 2011 at 9:50
  • 1
    @Goran: I just tested the exact configuration above on a wamp server and it works exactly as you want. Commented Jul 21, 2011 at 10:26
  • When I added NameVirtualHost *:8089 everything started working. Commented Jul 21, 2011 at 11:06

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.