Advertisement:

Author Topic: Serving the same files to two different addon domains  (Read 986 times)

Offline Quaideo

  • Newbie
  • *
  • Posts: 1
Serving the same files to two different addon domains
« on: September 28, 2017, 12:08:37 PM »
Hi all.

First time poster, and relatively new and self taught developer. Be gentle!   ;)

Ok, So I'm using cPanel and I have two addon domains against my main domain... maindomain.uk, addondomain.uk and addondomain.ie (the same domain name but different TLDs). Due to differing laws in the two countries governing the subject matter of my sites, the two addon domains will be mostly completely different from each other. However, I want users to access the same forum so that the forum benefits from the input of users from both countries. Obviously, I've chosen SMF for the forum software.

While I've found the settings and can amend both domains to use the same database, and so effectively they'll be the same forum, it seems like I should go a step further and actually serve the SMF files from the same location too. So that if a change is required, that I'm only having to do it once and both domains will see the updates.

My hosting provider suggested a .htaccess redirect but my understanding of this is that the browser will be redirected to a different page rather than just the file requests of the server being redirected. I'd want addondomain.uk/community and addondomain.ie/community to remain distinct URLs in the user's browser but serve the same files.

A suggestion from cPanel's own forum was that I could use the same document root for both domains. But only the forum files should be shared between the two domains, the rest of the pages on the sites will be completely different. So this solution is unsuitable as well.

I think subdomains is the closest solution so far. I can set up a 'community' subdomain on both domains and have them both pointing to the same folder in my document root. But, there will be some settings that need to remain individual, anything that involves a URL or email address for instance. If I go this route I may need to figure out some way of recognising which domain the user is currently viewing and deliver those type of settings based on that info. Which is why I'm posting here, I'd imagine you guys are gonna know the ins and outs of SMF better than any other forum.

If anybody has any ideas how to proceed with this, I'd be very grateful to hear them. Hopefully I've explained well enough what I'm looking to do but please ask me questions to clarify if I haven't done a good enough job of that already.

Hope you can help. Cheers.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,038
    • Arantor on GitHub
Re: Serving the same files to two different addon domains
« Reply #1 on: September 28, 2017, 01:26:06 PM »
Serving the same forum from two different places ends badly. SMF *really* doesn't like it and will go out of its way to prevent you doing it (if nothing else, for security). It also tanks your search engine rankings to have the same content on two separate domains even if they're both yours.

The ideal is that you have one forum - probably even on the maindomain - and just funnel people to it from the add on domains.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.