[Solved] Redirect www subdomain in Umbraco Cloud?
# help-with-umbraco
t
I have inherited a couple of Umbraco Cloud sites. These are set up under Umbraco Cloud > Configuration to listen to both
domain.com
and
www.domain.com
. The site is viewable on both domains, and rewrites metadata to the specific domain you visit, for example
<meta property=og:url content="https://domain.com/">
and
<meta property=og:url content="https://www.domain.com/">
respectively. Obviously this is bad for SEO, we need to decide on one and redirect to the other. What alternatives do you have within Umbraco and Umbraco Cloud? I know there are other solutions based on how your domain provider can handle redirects etc but I wonder if Umbraco Cloud it self has any functionality that could help, or if there's a common way to handle this in Umbraco? Or even .NET in general?
w
You could have an IIS rewrite rule which picks up when the leading www is missing, then do a permanent redirect to the URL including the www prefix. For .net core sites this involves installing the suitable URL rewrite module and configuring it in your solution but it's worked for sites I've been involved with before
t
@weedroid Do you know if you can use these kind of rules in an Umbraco Cloud context?
j
They recommend IIS rewrite rules themselves, and I can confirm they work out of the box: https://docs.umbraco.com/umbraco-cloud/set-up/project-settings/manage-hostnames/rewrites-on-cloud#redirect-from-non-www-to-www Can just add a web.config with the rules
t
That's great, thank you!
11 Views