In the past, BitBucket allowed CNAME to use custom subdomains like hg.yourdomain.tld. But recently, Atlassian decided to remove this feature,

You can drop the DNS record and update your documentation, but that will be a violation of Cool URIs don’t change and you can’t update paper documentation, bookmark from other users, etc.

If you want to keep these URL workings, you can create a server block in nginx and provide location blocks to redirect all the traffic from sub.yourdomain.tld to bitbucket.org/<account or team name>.

You can also take this opportunity to migrate Mercurial repositories to Git if you’ve only used your own URL.

In this example,I renamed the Mercurial zed repository as zed-hg, redirected legacy URLs to legacy Mercurial repository:

Use a regular expression starting by /yourrepository to catch the remaining of the request. Remember the final slash is facultative, and so the request can be captured as (/?*.) instead of /(.*).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.