Do you use subdomains?
source link: https://dev.to/madza/do-you-use-subdomains-2go1
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Do you use subdomains?
May 8
・1 min read
Subdomains are the part of a domain that comes before the main domain name and domain extension. They are created to organize and navigate to different sections of the website.
Do you use subdomains for your personal domain like awesomeproject.mydomain.com
?
If so, could you elaborate on your reasons why do you prefer them over subdirectories like mydomain.com/awesomeproject
or buying a dedicated domain like awesomeproject.com
?
Discussion (10)
Yes. I use the subdomains to let some services be Docker container and map them to specific subdomains.
CollapseExpand
There is one reason I prefer sub domains: you don’t need special configuration for routing.
You serve from root path and the subdomain is the job of the front-end webserver. Internal routing starts from /, no messing with prefixes.
CollapseExpand
For docs in a first place, always docs.mydomain.com
Just think it's easy and quite common.
A couple of months ago I also split our ecosystem with a dedicated website and an app (prefixed app........) instead of a "monolyth".
Doing so I can have a slick and easy prerendered website and a PWA without SSR or pre-rendered complexity.
interesting.
the docs subdomain is for API docs?
I mostly do frontend work so a general docs or dedicated to the components but, yes I would say documenting the API would be a good fit, I guess. What do you think?
For example that's the docs of one of my side project.
Thread
Thread
I'm in process of writing documentation for a frontend project and it is hosted on a virtual directory now, but will change it soon to a subdomain. thanks for your tip.
For backend projects, I don't think using docs as a subdomain for API IMO is a good idea because of versioning, you'll end up having different levels of subdomains like docs.v1.example.com.
Of course, it depends on how the project is structured.
Usually, I use subdomains for self-hosted projects and to create dedicated environments like dev.example.com
testing.example.com
CollapseExpand
I'm very glad you asked this question because it really makes me think.
Traditionally, I use free services, so that's a subdomain, but as of recently I've been plugging into my 3 domains because HTTPS is free. All I did to get HTTPS was set my domain DNS to Cloudflare, added one A record to skirbunk.com for the service IP in DNS, and added one CNAME record to www for @ in DNS.
What I've learned about using a subdomain is that it's always the child of the TLD, so if your visitors can block the first level domain because it's a service and just look at the subdomain as the focal point, then ya maybe. If you're wanting your visitors to focus only on that website, then you want a domain not a subdomain.
These are the questions I drew from your question.
- How do I want most of my visitors to get to the site?
- Is the website an addition to one that is already known?
- Do I expect visitors to remember more than one name?
These questions should help to make that decision.
CollapseExpand
yes, they are very useful for splitting up servers or type of stack being used.
CollapseExpand
you can point subdomains to completely different infrastructure, I have subdomains running on netlify, vercel and a paid hosting service
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK