2

I have several domains registered with 123-reg and I have shared hosting with them with an associated primary domain. Some of my domains are for specific clubs whose websites all start at the same index.php in a folder beneath public_html.

I want to point the club domains at this folder and for the user to see those domain names in the their browser's address bar and I'd want to be able to test them in the server or HTTP values accessible in PHP.

Try as I might, although I can get the club domains redirected, I can't retain them in the request that PHP receives. 123-reg support say this is a developer issue, but if it were possible for a developer to change the URL that would be a serious security issue. I feel what I want should be possible using 123-reg's cPanel. Can anyone explain how?

It appears I have added a subdomain but not redirected. It shows in cPanel as chrisandaud.cjhall.uk with its root (correctly) at public_html/fixsec30 where chrisandaud.me.uk is used to create the subdomain on cjhall.uk. If I browse to chrisandaud.cjhall.uk/phptest.php I get a can't reach error. If I browse to chrisandaud.me.uk/phptest.php I get the correct page, but the URL in the browser says cjhall.uk/fixsec30/phptest.php.

I'm not a professional webmaster so please forgive my ignorance. I must be overlooking something simple!

Thanks, MrWhite. I took 123-reg advice and followed https://www.123-reg.co.uk/support/hosting/how-do-i-add-a-domain-name-to-my-webhosting-package/ to point my chrisandaud.me.uk domain name but I didn't share the same root, I pointed to the /fixsec30 beneath it. The 123-reg cPanel under subdomains shows I have chrisandaud.cjhall.uk pointed at public_html/fixsec30 and not redirected.

Double-checking things in 123-reg cPanel I see this: Looking at cPanel items under DOMAINS: I seems to have chrisandaud.me.uk as both an Addon Domain and a Subdomain. Under Subdomain it is listed as chrisandaud.me.uk and it says its Document Root is at (Home)/public_html/fixsec30 and its Subdomain is chrisandaud and it is not redirected. Under Subdomain it is listed as chrisandaud.cjhall.uk and it says its Document Root is at (Home)/public_html/fixsec30 and it is not redirected. I have no aliases and no redirects.

Using File Manager I cannot see any .htaccess files

Browsing to www.chrisandaud.me.uk/phptest.php gives me the correct content but shows www.cjhall.uk/fixsec30/phptest.php in the address bar. Any ideas?

7
  • What mechanism are you using to redirect the domains? Commented Sep 22, 2021 at 12:01
  • "It appears I have added a subdomain" - so you are talking about "subdomains", not "domains"? "where chrisandaud.me.uk is used to create the subdomain on cjhall.uk" - not sure what you mean by that? "If I browse to chrisandaud.cjhall.uk/phptest.php I get a can't reach error" - what do you mean exactly by "can't reach error"? That sounds like a DNS resolution error, but if you've created the subdomain in cPanel you really shouldn't be getting a DSN error?!
    – MrWhite
    Commented Sep 23, 2021 at 21:55
  • "but the URL in the browser says cjhall.uk/fixsec30/phptest.php" - and you've definitely not created the subdomain as a "redirect" in cPanel? You say you've not, but that is exactly what will happen if you have. The other possibility is an incorrectly configured (canonical) redirect in .htaccess. Do you have any .htaccess files? There could be more than one in subdirectories? If you have then please edit your question to include these.
    – MrWhite
    Commented Sep 23, 2021 at 22:01
  • Taking a step back for a moment... how are the two domains cjhall.uk and chrisandaud.me.uk related? How are these configured in your cPanel account?
    – MrWhite
    Commented Sep 23, 2021 at 22:18
  • "I took 123-reg advice" - So, is this resolved then?
    – MrWhite
    Commented Sep 24, 2021 at 16:43

1 Answer 1

3

Since all your domains are registered with the same provider as your hosting you would need to add these domains in your cPanel account as either a:

  • "Domain Alias" (formerly "Parked Domains") - the domain points to the same document root/site as the main domain.

OR

  • "Addon Domain" - the domain points to a subdomain of the main domain, which could be a subdirectory off the main domain or somewhere else entirely.

Neither of these options should be configured as a "redirect".

That is, of course, if your shared hosting account supports this. The most basic "Starter" package at 123-reg only appears to support "1 website", so this would not be possible. Other packages appear to support "unlimited websites". Source: https://www.123-reg.co.uk/web-hosting/

And that is pretty much it.

Try as I might, although I can get the club domains redirected, I can't retain them in the request that php receives.

There should be no "redirect" here. Redirecting is an additional option in cPanel which should not be invoked.

Otherwise, if these "Addon" domains are redirecting to the main domain (for instance) then this is likely to be a configuration issue in your code. WordPress, for instance, will likely redirect to the canonical domain by default.

123-reg support say this is a developer issue, but if it were possible for a developer to change the url that would be a serious security issue.

Only you, the site owner can configure "Domain Alias" and "Addon Domains" on your account. Without this, your server will not accept requests to these domains.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.