Question

I'm pretty new in webserver management. So I rented this server, and setup a LAMP server with MySql and everything is alright in that sense.

The problem is now that I have two different domains (say www.domain1.com, www.domain2.org), and I want each of them to load the website content from a different folder on my server.

How can I do that?

I tried to google some relevant terms, but I couldn't find what that's called.

Thank you for any efforts.

Was it helpful?

Solution

If you use Apache2, you can use the ServerName directive in the VirtualHost configuration:

<VirtualHost *:80>
    ServerName www.domain1.com
    DocumentRoot /folder1
</VirtualHost>

<VirtualHost *:80>
    ServerName www.domain2.com
    DocumentRoot /folder2
</VirtualHost>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top