简体   繁体   English

CNAME域转发支持

[英]CNAME Domain Forwarding Support

Lets say for example my website address is: www.example.com 假设我的网站地址为: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. 我让我的用户在user1.example.com,user2.example.com上都有一个网站-我已经通过通配符子域等实现了此目的。

How can I let my users have these sites (which I host) at specialpage.theirsite.com? 如何让我的用户在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? 他们会为指向userpages.example.com的特殊页面添加一个cname记录-一旦指向这些页面,我将如何处理这些页面? Preferably in PHP! 最好在PHP中!

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. 最好的解决方案是使用CloudFlare通配符DNS条目将所有未设置的子域指向userpages.example.com的A记录,然后在userpages.example.com目录中使用php脚本检查子域是否已设置。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM