Take the 2-minute tour ×

I plan to implement a feature on my website where users can point their domain to sub domain provided by my service.

Sub Domain provided to John by my service is john.myservice.com

John bought this domain www.john.com and wants to map it to john.myservice.com

I know this can be done with Virtual Hosts if I am using Apache server but what am I interested to know is if is there an easy way to achieve this without me writing PHP stuff to update vhosts file every time user register with my service?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You could use wildcard/dynamic subdomains so you would just have one virtual host entry and it would work with any subdomain. Take a look at http://joshduck.com/blog/2010/07/13/dynamically-define-subdomains-with-apache/ to see how to set it up.

share|improve this answer
That's what I wanted. Thanks! –  Umair Aug 3 '12 at 21:18
add comment

Your Answer


