I stumbled across this question because I have two domains displaying identical content, and I need to make one direct to the other DNS rather than share content.
I will answer this question by stating my current problem, as it seems that my problem is a solution to this question.
I have virtual hosts set up on one VPS, my httpd.conf file located at /etc/httpd/conf/httpd.conf
on my server. If you don't know where it is on yours and that is not it, type # httpd -V
in the terminal. This page explains in more detail. Notice the line in red, and the bolded line at the bottom.
-D HTTPD_ROOT="/etc/httpd"
and -D SERVER_CONFIG_FILE="conf/httpd.conf"
Put them together and you get the location. /etc/httpd/conf/httpd.conf
This is my httpd.conf's contents at the virtual hosts.
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/com/me
ServerName ryan-mortensen.me
ServerAlias *.ryan-mortensen.me
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/com/unipartisan
ServerName unipartisan.com
ServerAlias unipartisan.org
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/com/mortensenmotors
Servername mortensenmotors.com
</VirtualHost>
I am hosting three web sites on this server. Notice the one in the middle, unipartisan.com. It has a server alias unipartisan.org which is also registered to me and pointed at the server in its DNS zone file.
In this configuration, if I type unipartisan.com, the page loads and the nomenclature of the .com is persistent. Likewise, if I type unipartisan.org the url continues to read .org as I go page to page.
While I find this an inconvenience I am to shortly resolve, this would do what you want.
website.com
. I am unable to import this content fromwebsite.com
toexample.com
, but I do have control over the content (and only the content) atwebsite.com
.example.com
is my preferred URL and I would always want to use it. I guess using a redirect or somehow getting control overexample.com
and its content is the best solution.