PDA

View Full Version : Addon Domains Question


s0l1dsn8k3
10-31-2006, 01:55 PM
My account has a main domain and a secondary domain that is already parked to this main domain.

I have two new domains, say a.com and b.com. These are separate from the main and secondary domains, so I probably needs to add these as Addon Domains.

I would like to keep a.com and b.com separate from each other, yet point to the same script that I would like to manually install. (Question 1) Is it possible to have both a.com and b.com point to the same directory, yet when typing b.com in the browser would not redirect the browser's address to a.com??

I have tried Addon Domain and added a.com (directory public_html/a; just typed 'a' in the directory field of Addon Domain, not 'public_html/a'. I'm just showing the relative location of 'a'). But if I add b.com and set the directory to be the same as a.com, the process fails.

I have also tried adding b.com to a separate directory (public_html/b) and tried to use .htaccess to redirect b.com's files to the physical location of a.com's directory (public_html/a; where the script is located). But because I'm not as knowledgeable with Apache's .htaccess, I could not get this to work. (Question 2) Is it possible to use .htaccess directives (such as from mod_rewrite, mod_alias) to redirect file access of public_html/b to public_html/a??

I know I can do simple PHP scripts to do include() of files in another directory but I prefer not to have any PHP files other than in public_html/a. Thanks in advance.

mojojuju
10-31-2006, 05:54 PM
I think I understand what you want.

I use symbolic links to accomplish this purpose with subdomains.

Try these instructions with your addon domains.

Go into cPanel and create a.com with the subdirectory a.
Go into cPanel and create b.com with the subdirectory b.

From the shell:

Go into your public_html directory where your "a" and "b" directories were created and enter the following which will remove the "b" directory:

user@domain.com [~/www]# rm -Rf b


Now, replace the "b" directory with a symbolic link to the "a" directory by the following:

user@domain.com [~/www]# ln -s a b


Now, domain b.com and a.com will use the same file's, yet the correct url for each domain will be shown in the address bar.

Here's a couple of examples using subdomains:
http://a.cbrich.com
http://b.cbrich.com

s0l1dsn8k3
11-02-2006, 01:15 PM
Thanks mojojuju ,

That symbolic link did the trick. I know it is possible to do symbolic links in Unix/Linux but kind of forgot since I haven't touched Unix/Linux for years since school days.

And instead of going through SSH, I used PHP script to execute the shell commands.