Moving from Wordpress to Astro
The maintenance fatigue and a major PHP security vulnerability pushed me to migrate my blog to Astro.
Cesar Villegas
For nearly two decades, my personal blog ran on PHP and MySQL—starting with b2 before moving to WordPress. I started writing in spanish and recently I decided to move to english language permanently. Over the years, keeping PHP, MySQL, themes, plugins, and core updated turned into a constant chore. Despite surviving plenty of automated attacks, having less free time meant letting my guard down and writing less.
When the critical PHP CGI argument injection vulnerability (CVE-2024-4577) hit, it became the wake-up call I needed. After evaluating several modern alternatives, I decided to move to Astro.
Switching from a dynamic PHP/MySQL stack to Astro shifts a blog from a constantly running application server to pre-built static output with modern components.
Key Advantages of Astro Over PHP
- Smaller attack surface: Static HTML output eliminates live database queries and server-side PHP execution on every request, removing entire classes of CMS, plugin, and database vulnerabilities.
- Less routine maintenance: There is no MySQL database to back up and tune, no WordPress core or theme updates to chase, and no fragile web of third-party plugins breaking after an upgrade.
- Fast performance by default: Pre-rendered HTML, CSS, and minimal JavaScript load quickly without cold starts, PHP worker bottlenecks, or bloated theme scripts.
- Content-first authoring: Writing in Markdown or MDX keeps posts in plain text files alongside your project, making drafting, editing, and Git version control straightforward.
- Modern component flexibility: Astro lets you structure layouts cleanly and ship JavaScript only for the specific interactive UI components that actually need it.
What It Takes to Migrate
Migrating from WordPress to Astro is mostly a content export and layout rebuild rather than a runtime upgrade:
- Export your content: Pull existing posts, pages, metadata, and media assets out of WordPress (via XML export, scripts, or database queries) and convert posts into Markdown or MDX files.
- Scaffold Astro and recreate the theme: Initialize an Astro project, configure content collections, and rebuild your header, post template, styling, and RSS/sitemap routes.
- Preserve URLs and assets: Match existing permalink paths (or set up redirects) and move uploaded images into place so old links continue to resolve.
- Build and deploy: Run
astro buildto generate static files and deploy them to static hosting or your web server.
I understand that not everybody has the technical knowledge to do this and many will prefer the simplicity of WordPress, especially if they are using a hosted version of WordPress or another CMS. In my case, I want to have control over everything, and now I can spend far less time worrying about server patches and far more time writing.
A big plus is that I am now able to write posts using Neovim or any text editor.
Browse categories
All articles →About the author
Cesar Villegas
Writing for over two decades on software engineering, practical AI, Linux systems, digital culture, opinion essays, and film, book, and music reviews.
Comments
Twikoo