XF 1.4 Prevent access to folder of subdomain on a primary domain

tommy2014

Active member
Hi Guys,

I have two domains running on the same hosting account. I was installed my Xenforo forum on a Primary domain of the root folder: public_html

As my hosting only allow to own one primary domain on one account, but i also want to install another Xenforo forum on the same hosting account, then i already purchased a second domain then created a folder under the root folder: public_html/seconddomain and upload all Xenforo data into this folder for the second website domain.

The problem here is that when people try to visit the Url: http://www.primarydomain.com/seconddomain --> it will automatically redirect to the content on my second domain: http://www.seconddomain.com/

So can i ask if anyone know how can I prevent people seeing the files at http://www.primarydomain.com/seconddomain and only when viewing them at http://www.seconddomain.com?

I have tried a few rewrite rule for the .htaccess file but it is not working.

I saw on the Xenforo installation files. There are two .htaccess files, which are: .htaccess and .htaccess.txt

If i make some changes for the .htaccess, do i have to do the same things for .htaccess.txt?

Appreciate your help on this.

Thank you so much
 
Uhhh...not exactly sure what you are trying to do... but if you have an actual second domain, then you only access it via the //second_domain.extension.
You do not use the primary_domain/secondary_domain.

Who are you hosting with...as it sounds like they may have something messed up.
I know that I have cPanel running on a VPS for some of my sites and a few others that I am hosting for people, and doing multiple domains lay out like you indicate - but you don't access them via the primary domain name.
 
I'm using a share hosting, not a VPS, Tracy... :(
That's exactly what cPanel is... I have my VPS set up to do a shared hosting environment. WHM account is set up there for my sites, one of the Tax companies I do work for and for Jeremy. It is the same as if you used GoDaddy or HostGator basically.

When Jeremy logs in, he sees basically the same thing that shows up on a HostGator login. Same thing with the tax company.
Screen Shot 2014-11-12 at 11.57.50 PM.webp Screen Shot 2014-11-12 at 11.59.51 PM.webp
 
Last edited:
I think I understand, I had a host once which made you put all secondary domains in a folder of the main public_html

A very simple 301 redirect inside the subfolder to secondary domain.com should work,

redirect 301 / http://secondarydomain.com/

This is the simplest, if it works with your host great, otherwise you need something like this in the root public_html

Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.primarydomain\.com [NC]
RewriteRule ^secondomainfolder/(.*) http://www.seconddomain.com/$1 [R=301,NC,L]
 
Last edited:
I think I understand, I had a host once which made you put all secondary domains in a folder of the main public_html
If the host allows the creation of AddOn Domains (what they are called in cPanel) then that would be the way they work out typically.... they create the secondary domains off the main /public_html location.

A very simple 301 redirect inside the subfolder to secondary domain.com should work,

If it is a true second domain (that's not related to the original), like say for another forum on another topic, then this won't work...not to mention the fact that setting up the second domain should have created a DNS entry for it.

Now, if we are talking about remapping a one domain to another, then a redirect will work.
 
I have tried both of resolution mentioned by Mr Lucky but it is still not working... I guess i will just move to a VPS service then. :(
These things can work differently depending on the host. I have known both of those methods to work.

You do need to fix this, if links to the subfolder get out, Google will see duplicate content.

Does the host not have a tech support that can help?
 
Back
Top Bottom