separate vhosts for www.domain.com and domain.com?

#1
Is it possible to have www.domain.com and domain.com as separate vhosts with separate document roots etc?

I remember seeing somewhere, a while ago, that OpenLiteSpeed automatically folds the two together, but I would like to separate them.

If so, how can I do it?

If I need to hack the code, any hints as to where...?

Thanks
 

Pong

Administrator
#2
Why do you want to separate there two? These two should be the same generally.
If you just want a new site, get another sub domain like forum.domain.com or sub1.domain.com should not be hard, and it is clear.

Here I am not talking if you can technically separate www.domain.com and domain.com, it is just good practice. You should have many ways to achieve your goal, but separating these domains is not a recommended way as far as I can see unless you have a very strong reason.
 
#3
The strong reason is that I have a client with a Wordpress website and a webapp, both running on www.domain.com
The web app is old, running PHP 5.4, and it will take time to migrate it to PHP7.x if that ever happens.

I want to move the Wordpress site to PHP7 in a completely different vhost, using www.domain.com to be consistent with existing SEO history of the domain, while moving the web app to example.com (instead of app.domain.com) to reduce confusion for the customers logging in.

I'll have all the appropriate redirects in place, so people end up where they expect to be.

Thus far, I have created two vhosts in a test OpenLiteSpeed but all of the example.com requests go to the www.example.com vhost.

While I agree that in most cases www and @ should be canonicalised by default, I do feel that the philosophy should not be hard coded.
 
Last edited:

Pong

Administrator
#4
Can you show me the snapshot of listener port 80 configurations with the domain to virtual host mapping?
You can easily define domain.com to virtual host 1 and www.domain.com to virtual host 2.
 
Top