SERPland Blog

Change subdomain with HTTPS to www and redirect (301) from HTTPS subdomain to HTTPS-WWW

· 521 words · 3 minutes to read

I have a website (blog) with a subdomain on Wordpress and would like to transfer it to Azure Static Web Apps using Hugo I would like to remove the subdomain and set the website (blog) to www. OLD: https://blog.serpland.com NEW: https://www.serpland.com

There are two things to consider here A) Transfer from Wordpress to Hugo to Azure Static Web Apps B) Change subdomain with HTTPS to www and redirect (301) from HTTPS subdomain to HTTPS-WWW. It would be easy if it was old HTTP, it will be difficult with HTTPS. But I have a simple solution.

A) Transfers from Wordpress to Hugo to Azure Static Web Apps 🔗

There are many tutorials on the internet for this, good, simple, flawed and complicated. My approach was:

  1. default full export to wordpress
  2. then use tool to switch from wordpress export xml file to hugo markdown files
  3. hugo runs locally on my PC, I use the markdown files from step 2
  4. categories/tags may require manual adjustments
  5. new repository on Github, generate hugo pages locally and push to Github
  6. create Azure Static Web App
  7. through the push from step 4, the static page is automatically created on Azure by a Github action
  8. switch DNS entries to Azure once (see next section)

B) Subdomain mit HTTPS auf www umstellen und Redirect (301) von HTTPS-Subdomain zu HTTPS-www 🔗

I have been looking for a solution for a long time Usually you have the following

  • A domain registrar, where I buy the domain name and set the DNS entry (i.e. where the domain name should point to).
  • A provider who runs my website, i.e. accepts requests. In my case:

OLD Domain registrar “Namecheap” –> DNS https://blog.serpland.com –> points to provider “Hostgator”, where my Wordpress “blog.serpland.com” is running

NEW Domain registrar “Namecheap” –> DNS https://blog.serpland.com –> points to provider “Azure”, where my static website generated from Hugo is running www.serpland.com Domain registrar “Namecheap” –> DNS https://www.serpland.com –> points to provider “Azure”, where my static website www.serpland.com generated from Hugo is running

Well, www is no problem, just switch to Namecheap (there are many instructions, the best can be found on the Microsoft Azure learning page).

But now the subdomain, that would also be easy if this subdomain didn’t have a https:// in front of it … I no longer want to use blog.serpland.com and would like to have a 301 redirect from https://blog.serpland.com to https://www.serpland.com. Usually domain registrars like Namecheap can easily create a direct 301 redirect or a DNS entry for the 301 redirect. But apparently not if it is an HTTPS connection. I have tried for hours and also contacted Namecheap support. All to no avail. It always resulted in HTTPS CONNECTION ERRORS.

Finally my really simple solution: The pizza HTTPS Redirect Service Domain registrar “Namecheap” –> DNS https://blog.serpland.com –> points to free redirect service “Redirect Pizza”, this can do https redirects on subdomain level –> 301 redirect to provider “Azure”, there runs my static website www.serpland.com generated from Hugo

So the pizza HTTPS Redirect service is THE solution. Free of charge if you don’t have too much traffic. It’s definitely worth it!

HTTPS Redirect

More information on the Redirect-Pizza info page