Addon Domain Document Root Directory

Status
Not open for further replies.

steve.ancheta32

New Member
Messages
4
Reaction score
0
Points
0
a blessed day to all,

I want to host another domain on my hosting account. I want to organize my websites by putting them on separate folders on my account root directory. but every time I add a domain and removing public_html on the document root path, it will still put the addon domain document root path inside public_html.

The reason I need this is because example I put my second domain to public_html/seconddomain folder, i don't want anybody to access the second domain site by www.primarydomain.com/seconddomain.

Many thanks in advance.
smiley.gif
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
that is the way that the system is set up here. You cannot avoid it.

What you can do is use the htaccess file in public_html to bar entry to the subdomain via the main domain.

Edit/Correction:

Use the .htaccess in the subdirectory containing the add-on

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?yourmaindomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.yourparentdomain.com [R=301,L]

This way, if they are entering the sub-directory via the maindomain, they will be redirected to the front page of the main domain (you can send them to anypage).
 
Last edited:

steve.ancheta32

New Member
Messages
4
Reaction score
0
Points
0
Thank you so much descalzo for your quick response. I appreciate it so much. And thanks for clarification regarding my hosting account and thank you for the instruction. I will try to do it now.

Another question, if is it possible to change the root directory folder of my main domain to a folder inside public_html? But not by using cPanel>Domains>Redirects. so that I will only see my maindomain folder and addondomain folder inside my public_html folder. I just want it to be neat.
 

Anna

I am just me
Staff member
Messages
11,752
Reaction score
582
Points
113
public_html will be the document root for your main domain.

It is doable through .htaccess to use a subfolder as document root for the main domain though, let me see if I can round up where I found the info when I was looking for it.

ADD: Believe this is where I found the info when I needed it a while back: http://www.zimplicit.se/knowledge/how-host-primary-domain-subfolder-using-htaccess (site is Swedish, but the important information is in English)
 
Last edited:

steve.ancheta32

New Member
Messages
4
Reaction score
0
Points
0
Thank you so much anna for your quick response. I'm very impress with the help that x10hosting is giving even if the service is free.

I have done the instruction but I'm having 404 error message always.
I have done some research but they have also the same instruction.
I posted here my .htaccess i think this will be needed for you to help me.
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?kenya.x10.mx$
RewriteCond %{REQUEST_URI} !^/kenya.x10.mx/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /kenya.x10.mx/$1
RewriteCond %{HTTP_HOST} ^(www.)?kenya.x10.mx$
RewriteRule ^(/)?$ kenya.x10.mx/index.html [L]
Just for testing I only put now one file on the "kenya.x10.mx" subdirectory which is index.html with a basic hello world code.

Add: I tried it on another webhosting company and it works. Maybe something to do with Lotus server that causing me this 404 error..?
 
Last edited:

steve.ancheta32

New Member
Messages
4
Reaction score
0
Points
0
Dear x10Hosting admins,

I humbly ask for any feedback regarding 404 error after I edit the .htaccess file as per instruction.

Sincerely,
Steve
 
Status
Not open for further replies.
Top