Pointing Add-on Domain to Existing Domain’s folder 2
In this article, I will guide you through a simple method to point an “add-on” domain (aka alternate domain) to an existing domain’s folder. There is another article about this, but compared to this, it requires more steps. This method, I believe does not work for Cpanel, unless you have somehow tweaked it’s file system. The method described in this article works for the Grid Service hosting account for MediaTemple, but it should work for other similar hosting environments too.
This is what I am attempting to do:
newdomain.com to show olddomain.com/folder and
newdomain.com/whatever-that-follows to show olddomain.com/folder/whatever-that-follows
You are required to have SSH access for this, which is available for (gs) accounts by default.
For the purpose of this article, newdomain.com and olddomain.com are used to explain the steps easily. You are trying to make newdomain.com appear as olddomain.com/folder. Please replace these names with your own.
Step (1)
Add the alternate domain to your account associated with your domain. (Note that domain name takes up to 48 to start working after you changed it’s nameserver.)
Step (2)
Create a directory(folder) under olddomain.com by any means you know. eg. “folder”
Step (3)
Connect to your SSH create a symbolic link from the newdomain.com to the olddomain’s folder you are trying to target by doing the following:
Ussing SSH, browse to your newdomain.com’s folder. In (gs), use the following:
cd domains/newfolder.com
Note:
cd is a command that moves you to another directory.
cd <relative to current dir> to move to that directory.
dir is a command that display all directories and files inside the current directory.
These are standard command line interface commands. Google for more.
Continue…
Now that you are in the newdomain.com folder. Use the following command. The following command assumes that you are using (gs), please modify it accordingly if your file system is structured differently. For (gs) users, replace ###### with own number too.
ln -s /home/######/domains/olddomain.com/html/[path to folder] ./html
Explaination:
ln -s is a command that creates a symbolic link from 1 path to another.
In this case, since we are in the newdomain.com folder, the ./html folder at the end is the sub-directory of the current folder you are in. Which is newdomain.com/html.
./html is linked to /home/######/domains/olddomain.com/html/[path to folder] (An absolute path to the olddomain.com’s folder you want).
More Information
If you are using Cpanel, please refer to the previous article.
For other Mediatemple accounts please refer to their kb article and adapt accordingly to achieve your desired result.