Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have taken domain www.exampledomoain.com and www.sampledomain.com on Debian server server. on first domain [www.exampledomoain.com] i am running one application on port 80 now i i have install new second app for witch i want to use second domain [www.sampledomain.com] ,now second app is running on port 8080 so current URL will be www.sampledomain.com:8080

Now Problems: 1.) i am not able to make www.sampledomain.com:8080 to www.sampledomain.com only how to do that i don't have idea. 2.) Now i want to create dynamic host name like [www.username.sampledomain.com , www.username2.sampledomain.com] which should be redirect to www.sampledomain.com only is their any configuration file is their or i have to install some app.

Thanks in Advance

share|improve this question

2 Answers 2

If your domain registrar allows them in the DNS settings, I think you should be able to do this using a SRV record. I have used SRV records with no-ip.com to do the same thing with a home-hosted site.

share|improve this answer
    
Thanks paradroid, –  Shashi Dec 2 '10 at 11:28
    
Let me check with SRV –  Shashi Dec 2 '10 at 11:28

1) The basic redirect setup is this:

<VirtualHost *:8080>
  <Location />
    RedirectMatch 302 /(.*)$ http://www.sampledomain.com/$1
  </Location>
</VirtualHost>

You may need to add other configuration around it. Make sure apache is configured to listen on port 8080, but it sounds like you've got that part covered already. The above config will preserve the request in full when redirecting; so:

http://www.sampledomain.com:8080/page.html  => http://www.sampledomain.com/page.html

2) You can use wildcard ServerAlias directives to catch these. Inside your VirtualHost configuration for sampledomain.com:

ServerName www.sampledomain.com
ServerAlias *.sampledomain.com

Your script/app can then grab the HTTP_HOST variable, if it needs to know what was specified.

share|improve this answer

Your Answer

 
discard

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.