PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, February 9, 2022

[FIXED] Forward two different websites to the same server

 February 09, 2022     debian, dns, forwarding, lamp, webserver     No comments   

Issue

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.


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>


Answered By - atenart
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing