Oops! This one is certainly more thoroughly complex than the rest of the steps of this “creating a new web site” tutorial. More positively, usually, you do not need to take this step.
In my personal case, for the creation of the Lexyk.com dictionary web site, I needed to add a small specific helper. I wanted all the sub-domains of Lexyk.com to point to the same location. In 99% of the web site, the only sub-domain used is
www. The only address that the visitor knows about is http://www.lexyk.com. Nearly all the web site servers are configured to use
www as the default sub-domain and nobody will notice anything peculiar.
But sometimes, you need to handle more sub-domains. The only easy way is to request access to a special information of the web server. On Apache servers, this is what is called
mod_rewrite. As I needed to be able to route all sub-domains to the same location, I requested the following
mod_rewrite from my hosting provider.