Cloudflare is widely recognized for its content delivery network (CDN) and DNS management services, but did you know you can also host a website for free using Cloudflare Pages? In this guide, I’ll walk you through what Cloudflare Pages is, its limitations, and even show you a clever workaround to host a WordPress site on it—completely free. Let’s dive in!
What is Cloudflare Pages?
Cloudflare Pages is a free feature included with every Cloudflare account that lets you host static HTML and CSS websites on Cloudflare’s global network. With over 320 server locations worldwide, sites hosted on Cloudflare Pages are incredibly fast—something I’ve experienced firsthand. You can upload your site files, manage your DNS through Cloudflare, and have a blazing-fast website up and running at no cost.
Key Limitations
Before you get too excited, it’s important to understand that Cloudflare Pages is designed for static websites only. This means:
- It supports HTML, CSS, and client-side JavaScript (via Cloudflare Workers for advanced users).
- It cannot run server-side code like PHP, which rules out native support for platforms like WordPress.
If you’re comfortable coding your own HTML, CSS, and JavaScript, you can create a sleek, simple site without needing a website builder. But for most users who prefer tools like WordPress or Webflow, there’s a catch: you’ll need to export your site as static HTML to use Cloudflare Pages. Don’t worry—I’ve got a workaround for that!
Hosting a WordPress Site on Cloudflare Pages
WordPress relies on PHP, which Cloudflare Pages doesn’t support. However, you can still use WordPress to design your site and then convert it to static HTML for free hosting. Here’s how:
Step 1: Set Up WordPress Locally
Since Cloudflare Pages can’t run WordPress natively, we’ll build the site on your computer using a free tool called Local WP:
- Download Local WP: This desktop app lets you run WordPress locally. Install it from their official website.
- Create a New Site: Open Local, choose “Create a new site,” and opt for a blank slate (or a blueprint, but avoid dynamic features).
- Name Your Site: Give it a name, stick with the default “Preferred” environment, and set up your WordPress username, password, and email.
- Add the Site: Click “Add Site” and wait for Local to install WordPress.
Once installed, click “WP Admin” to access the WordPress dashboard in your browser.
Step 2: Build Your WordPress Site
Design your site as you normally would in WordPress, but keep it static:
- Avoid dynamic features like e-commerce or contact forms (they won’t work on Cloudflare Pages).
- Focus on pages with text, images, and basic styling.
If you’re new to WordPress, check out free resources like my Craylor Academy course (linked below) to learn the basics.
Step 3: Export Your Site as Static HTML
To convert your WordPress site to static files, use the Simply Static plugin:
- In your WordPress dashboard, go to Plugins > Add New.
- Search for “Simply Static,” then click Install Now and Activate.
- Go to the Simply Static menu in the sidebar and click Generate.
- Check for errors:
- If it warns about an SSL certificate (common with Local), ignore it—it won’t affect the export.
- For PHP or other errors, troubleshoot them before proceeding.
- Once generated, view the Activity Log, scroll to find the ZIP file link, and download it.
Step 4: Upload to Cloudflare Pages
Now, let’s get your site live on Cloudflare:
- Log in to your Cloudflare dashboard.
- Navigate to Workers & Pages > Overview > Pages.
- Click Upload assets, name your project (lowercase, no spaces), and click Create project.
- Upload the ZIP file from Simply Static (don’t extract it—just upload it as is).
- After uploading, click Deploy site.
- Visit the provided URL to ensure it loads. If you see an error, wait 5-10 minutes and try again—propagation can take a moment.
Step 5: Connect a Custom Domain
To use your own domain (e.g., yourdomain.com):
- In your Cloudflare Pages project, go to the Custom domains tab.
- Click Set up a custom domain, enter your domain, and click Continue.
- If your domain isn’t managed by Cloudflare DNS yet, add it by updating your registrar’s nameservers to Cloudflare’s (choose the free plan).
- Once added, click Activate domain. Wait a few minutes for it to propagate.
- Optional: Add a www version (e.g., www.yourdomain.com) by repeating the process.
Your site should now be live on your custom domain!
Step 6: Updating Your Site
To make changes:
- Open Local WP, edit your site in WordPress, and re-export it with Simply Static.
- In Cloudflare Pages, upload the new ZIP file to replace the old assets—no need to redo DNS setup.
Adding a Contact Form (Hack)
Since dynamic features don’t work natively, you can embed a third-party contact form:
- Use services like WUFOO or Google Forms to create a form.
- Copy the HTML embed code and add it to your WordPress site before exporting.
- The form will function via the third-party service’s servers, keeping your site static.
It won’t look as seamless as a WordPress plugin form, but it gets the job done.
Pros and Cons of Cloudflare Pages
Pros
- Free: No hosting fees!
- Speed: Static sites load incredibly fast on Cloudflare’s global network.
- Reliability: Cloudflare’s infrastructure is top-notch.
Cons
- Static Only: No server-side code or dynamic features without workarounds.
- Extra Steps: Exporting and uploading files takes more effort than traditional hosting.
- Limited Flexibility: Updates require re-exporting and re-uploading.
If you need dynamic features like e-commerce or seamless updates, consider budget hosting options like DreamHost or Hostinger (under $10/month). Check my hosting comparison video for details.
Final Thoughts
Hosting a website for free on Cloudflare Pages is a fantastic option if you’re on a tight budget and don’t need dynamic functionality. It’s fast, reliable, and leverages Cloudflare’s powerful network. While the WordPress workaround adds some steps, it’s a great way to combine the ease of WordPress with free hosting.
Resources:
- Local WP: Download here
- Simply Static Plugin: Available in the WordPress plugin directory
