0
votes

Lets say for example my website address is: www.example.com

I let my users each have a website at user1.example.com, user2.example.com - I have achieved this through wildcard sub domains etc.

How can I let my users have these sites (which I host) at specialpage.theirsite.com? They would add a cname record for specialpage pointing to userpages.example.com - How would I handle hosting these pages once they have been pointed? Preferably in PHP!

1

1 Answers

0
votes

The best solution is to use CloudFlare wildcard DNS entries to point all unset subdomains to the A record for userpages.example.com and then use a php script in the directory for userpages.example.com to check if the subdomain has been setup.

<?php
$subdomain = array_shift((explode(".",$_SERVER['HTTP_HOST'])));
if ($subdomain IN DATABASE) echo DATABASEOUTPUT;
else echo 'Domain: "' . $subdomain . '.example.com"';
?>