How to migrate from WordPress to a static website with Hugo and AWS

Recently, I got a reminder that my domain name and shared host would eventually expire this summer. I always had a WordPress for my website and thought it was time to move on for something easier to maintain. Here is how I managed to migrate my WordPress blog to a static website with Hugo on AWS.

WordPress to Hugo

Static website has the advantage to load faster than dynamic. Content doesn’t change everyday, same as my blog, that’s why it’s a good fit for me.

My first step was to find what tool to generate my static website. After couple research, I decided to use Hugo, a trendy and fast static website engine. It’s also based on markdown file, that make it even more friendly for developers and allows git versioning.

Next step was to convert and export my previous posts from WordPress. This part is quite easy with wordpress-to-hugo-exporter plugin. You only need to install it on your website and click export. It will create a nice zip with all blog posts and images.

Then I installed Hugo on my local environment. Their quickstart is really intuitive, I only needed to add a theme to mine. Once I integrated my previous blog into it, I fixed most of links and images to point local folder instead of remote server.

Localhost hugo

With hugo command, a public folder was create. My website was ready, it was time to upload it.

Hosting on AWS

I mostly use AWS for their notification service SNS. However I didn’t know how storage and domain worked. It was a good opportunity to try and learn at the same time. It’s also known that you pay as you go which means it would eventually be cheaper than my previous plan ($100 / year).

AWS has also a nice quickstart to store website. I chose to start from scratch and change my domain from .fr to .com at the same time. While registering my new domain, I created a new bucket on AWS S3 and stored my generated files from Hugo. I could my website online but still with the wrong domain.

Once the domain live, I updated AWS Route 53 rules to point it to my new bucket. My domain was live with the new website on it.

A tip to cover www. domain redirection, I created another bucket in S3 it and redirect all requests to my main domain. It also required to update AWS Route 53 to resolve www. domain.

AWS Storage

It was time to disable my previous domain and website.


For a domain migration, main issue is to lose your previous SEO but Google has nice tools and tips to avoid that. To avoid that, I registered my new domain on Google Webmaster Tools.

On Webmaster Tools, you can change from an old domain to a new one. This is mainly to help Google index your new website, minimizing impact on your current SEO score.

Google Webmaster tools

Finally, last step is to redirect old domain to the new one permanently. A quick rule in my .htaccess makes it. Note 301 code for permanent redirection.

RewriteEngine on
RewriteCond %{HTTP_HOST} !^benoitpasquier\.com
RewriteRule (.*)$1 [R=301,L]

After the migration, I had issue with Google Analytics, my domain wasn’t tracking visit even after updating my view on the dashboard. Because my traffic was quite constant anyway, I just recreated a new tracking ID within a new view to be sure to have clean data.

At the end, my old domain is inactive, redirecting to a new domain with a static website. I was surprise how fast it was, my main issue was around AWS because I wasn’t familiar, but otherwise it’s pretty much straight forward.

© 2023 Benoit Pasquier. All Rights Reserved
Author's picture

Benoit Pasquier

Software Engineer πŸ‡«πŸ‡·, writing about career development, mobile engineering and self-improvement

ShopBack πŸ’°

Singapore πŸ‡ΈπŸ‡¬