如果我已经购买了一个域名,那么我无法将子域路由到Heroku上托管的Wordpress博客,根域也是另一个Heroku应用程序。在NameCheap上称为 cheese ,我想要路由一个子域,如 blog.cheese 我怎么可能在Heroku上这样做?
我需要在每个Heroku应用程序中放置什么类型的设置?
解决方案我不知道NameCheap的确切方向,但是将子域重定向到Heroku应用程序的一般方法是将CNAME记录添加到子域。要重定向根域,您需要在区域顶点设置类似CNAME的功能。
子域
blog.cheese将有一个CNAME记录指向myblog.herokuapp,您可能还想为www.blog.cheese创建一个CNAME记录。
示例记录可以是:
名称:blog.cheese TTL :14400 类型:CNAME 地址:myblog.herokuapp一次两个CNAME记录都设置好了,你需要告诉heroku将域指向你的应用程序。
heroku domains:add - app myblog.herokuapp blog.cheese如果你对这两个子域都这样做,他们应该现在指向您的Heroku应用程序。
根域
指向根您需要设置几个记录
主机名:@ URL:http:// www。 C heese 记录类型:URL重定向 主机名:www URL:mymainpage.herokuapp 记录类型:CNAME(别名)一旦这两个记录都设置好,只需通过Heroku调用下面的命令来指向您的域名。
heroku domains:add --app mymainpage.herokuapp cheese这里有几个地方可以寻找额外的信息。
点击nokecheap域到Heroku
自定义域名Heroku开发中心
I'm having trouble with routing a subdomain to a Wordpress blog hosted on Heroku, and the root domain to another Heroku app.
If I have purchased a domain called cheese on NameCheap and I'd like to route a subdomain like blog.cheese how could I do this on Heroku?
What type of setting would I need to place on each Heroku application?
解决方案I'm not sure of exact directions for NameCheap but the general way to redirect a subdomain to the Heroku app would be to add a CNAME record to the subdomain. To redirect the root domain you will need to set a CNAME like functionality at the zone apex.
Subdomain
blog.cheese would have a CNAME record pointing to myblog.herokuapp, you may also want to create a CNAME record for www.blog.cheese.
An example record could be:
Name: blog.cheese TTL: 14400 Type: CNAME Address: myblog.herokuappOnce both CNAME records are set up you will need to tell heroku to point the domain to your app.
heroku domains:add --app myblog.herokuapp blog.cheeseIf you do this for both your subdomains they should now point to your Heroku apps.
Root Domain
To point the root domain you will need to set a couple of records
Host Name: @ URL: www.cheese Record Type: URL Redirect Host Name: www URL: mymainpage.herokuapp Record Type: CNAME (alias)Once both records are setup just call the command below via Heroku to point your domains to it.
heroku domains:add --app mymainpage.herokuapp cheeseHere are a couple of places to look for extra information.
Point namecheap domain to Heroku
Custom Domains | Heroku Dev Center
更多推荐
如何将子域指向Heroku应用程序,并将根域指向另一个Heroku应用程序?
发布评论