probably a rookie question and not solely Kirby related.
However, maybe somebody can clarify nevertheless.
I have a domain at Strato that also includes a SSL certificate.
The certificate is valid for the apex domain, lets call it ‘stratodomain.de’ as well as the subdomain ‘www.stratodomain.de’. Without configuring any redirection in the Strato admin interface both names get routed to the root of my webspace. So far so good.
However, when looking into the ‘site/cache’ folder I can see 2 subdirectories, one for the www domain and one for the naked domain. So it looks like the cache contents is duplicated, one for the apex domain and I suspect the same content for the www subdomain.
Therefore my question is: Is it advised to configure an explicit redirection of one of the domains to the other?
There are two perspectives regarding this question.
I hope to get at least an advice how to handle this from the Kirby perspective.
Nevertheless I would also appreciate if somebody could add some information regarding the SEO perspective.
Without an explicit redirection it looks to me like a search engine would treat both names as separate domains which is obviously also the reason that Kirby creates the duplicate cache entries.
Also what would be the pros and cons between:
www-subdomain —> apex-domain versus apex-domain —> www-subdomain
You should definitely redirect one to the other to prevent duplicate content. In the past, the www subdomain was predominant for web services, that has changed since. But if you look at websites like google.com, amazon.com, bing.com, apple.com, they still redirect to the www subdomain.
I’d recommend you actually google that and read a bit about this to make an educated decision. If, for example, you need a CNAME record for certain services, then you should know that you cannot use a CNAME record on the bare domain.
In both you find the advice you had given, i.e. to redirect one to the other. According to those two links it’s also important for SEO.
The discussion regarding which to redirect to which seems a little opinionated. As you said, the main technical reason to redirect the bare domain to the www subdomain seems to be the CNAME issue. The supporters of the reverse redirection are mostly concerned about the additional redirect that will occur in the majority of cases since people are nowadays used to omit the www prefix.
I’m a little surprised that I only found advice in discussions on sites like serverfault or stackoverflow and not on the help pages of the webhosters. Quite frankly if the additional folders in the Kirby cache directory wouldn’t have pointed me to this issue, I would have probably never given a thought about it because the setup, at least on Strato, did work for both names without explicitly configuring a redirection. They seem to do this for the convenience of their users, so that people don’t need to bother with redirection and it will still work for the bare and the www name. However, this will leave a lot of users with a not optimal configuration.
Maybe it would be worth to include your advice on one of the documentation pages.