Use VirtualHosts in your httpd.conf.
Also, make sure the DNS configuration points both domains to the same server.
For example:
<VirtualHost *:80>
DocumentRoot /path/to/domain1.com/html
ServerName www.domain1.com
ScriptAlias /cgi-bin/ /path/to/domain1.com/cgi-bin
<Directory "/path/to/domain1.com/cgi-bin">
Options ExecCGI
</Directory>
ServerAdmin youremail@adress.com
<Directory "/path/to/domain1.com/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /path/to/domain2.org/html
ServerName www.domain2.org
ScriptAlias /cgi-bin/ /path/to/domain2.org/cgi-bin
<Directory "/path/to/domain2.org/cgi-bin">
Options ExecCGI
</Directory>
ServerAdmin youremail@adress.com
<Directory "/path/to/domain2.org/html">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
Hope this helps!
EDIT
Here is a minimal virtualhost entry (you can put multiple entries in one httpd.conf file):
<VirtualHost *:80>
DocumentRoot /path/to/website.com/html
ServerName www.website.com
<Directory "/path/to/website.com/html">
Require all granted
</Directory>
</VirtualHost>
That (to my understanding) is the minimum required information for a VirtualHost. If any one knows otherwise, go ahead and let me know/edit the question.
Thank you for the answer. I'm using an Apache server. Should I really define ScriptAlias? – The Quantum Physicist – 2014-01-18T19:44:55.123
If you have want a www.domainname.com/cgi-bin/ directory. Otherwise, it isn't necessary. I'll update the question with a "minimum" vhost entry. – BenjiWiebe – 2014-01-19T02:09:16.563