Move WordPress to a Blog Folder with Custom Front Page
This guide shows you how to move your WordPress site from the root of your domain (e.g., example.com) into a subfolder (e.g., example.com/blog) while keeping a custom static front page at the root. You’ll end up with a homepage that isn’t part of the WordPress blog, while all posts and pages live under the /blog folder. This is useful for adding a landing page, portfolio, or company site in front of your blog without running two separate installations.
What You’ll Need
- Access to your hosting control panel (cPanel, Plesk, or similar) and file manager, or FTP/SFTP credentials.
- Access to phpMyAdmin or another database management tool.
- A backup of your entire WordPress directory and database (do not skip this).
- Your WordPress admin login credentials.
Step-by-Step
- Back up everything. Download a full copy of your WordPress files from the root (usually
public_htmlorwww) to your computer. Export your database via phpMyAdmin using the “Export� tab (choose SQL format). Store both safely. - Create the blog folder. In your hosting file manager, create a new folder inside the root, e.g.,
blog. The name is up to you, butblogis common. - Move WordPress files. Move all WordPress files and folders (including
wp-admin,wp-includes,wp-content,wp-config.php,.htaccess, and all others) from the root into theblogfolder. Do not move any non-WordPress files (like a customindex.htmlorassetsfolder) unless they are part of your theme. - Update the WordPress URL in the database. Open phpMyAdmin, select your WordPress database, and run the following SQL query (replace
yourdomain.comwith your actual domain):UPDATE wp_options SET option_value = 'https://yourdomain.com/blog' WHERE option_name = 'siteurl'; UPDATE wp_options SET option_value = 'https://yourdomain.com' WHERE option_name = 'home';
If your table prefix is not
wp_, adjust it accordingly. This tells WordPress that the core files are in/blogbut the site’s home URL remains at the root. - Update permalinks. Log in to your WordPress admin at
https://yourdomain.com/blog/wp-admin. Go to Settings → Permalinks and click “Save Changes� to refresh the rewrite rules. This updates the.htaccessfile in theblogfolder. - Create a custom front page. In the WordPress admin, go to Pages → Add New. Create a page called “Home� (or any name) that will serve as your front page. You can leave it blank for now or add content. Publish it. Then create another page called “Blog� (or “Posts�)—this will be the page that displays your blog posts. Publish it.
- Set the front page and posts page. Go to Settings → Reading. Under “Your homepage displays,� select “A static page.� For “Homepage,� choose the page you created (e.g., “Home�). For “Posts page,� choose the page you created for the blog (e.g., “Blog�). Save changes.
- Add a root index file. Now you need to make the root URL (
https://yourdomain.com) show your custom front page. Create a file namedindex.phpin the root folder (if it doesn’t already exist—if it does, back it up and replace it). Add the following code to it:<?php // Load the custom front page that you created in WordPress. // This file sits outside the WordPress installation and simply redirects to the page. header('Location: /blog/'); exit; ?>If you want the root to display a fully custom HTML page instead of redirecting, you can create an
index.htmlfile with your own content. The redirect method is simpler and keeps everything within WordPress. - Test everything. Visit
https://yourdomain.com—you should see your custom front page (or be redirected to/blog/). Visithttps://yourdomain.com/blog—you should see your blog posts page. Click through a few posts and pages to confirm permalinks work (they should appear as/blog/post-slug/). - Update any hardcoded URLs. If your theme or plugins have hardcoded URLs (e.g., in custom code or widgets), update them to the new
/blogpath. Also, check your site’s XML sitemap and update it if needed.
Common Mistakes
- Forgetting to update the
homeoption. If you only updatesiteurlbut nothome, the site may load but links break or you get redirected incorrectly. - Moving files while the site is live. This can cause downtime or errors. Do it during a low-traffic period and keep a backup ready.
- Not updating
.htaccess. If permalinks break, go to Settings → Permalinks and save again. Also ensure the.htaccessfile in theblogfolder has the correct rewrite rules. - Leaving old files in the root. If you leave WordPress files in the root, they may conflict with the new setup. Remove them after moving.
- Using the wrong table prefix. If your database uses a custom prefix, the SQL query will fail. Check
wp-config.phpfor the prefix.
Tips
- Use a staging site. If possible, test the move on a staging copy first to avoid breaking your live site.
- Keep a maintenance page. Before moving, put up a maintenance page (using a plugin or a simple HTML file) to hide the half-moved state.
- Search and replace carefully. If you have many hardcoded URLs, use a search-replace tool (like WP-CLI or a plugin) to update them in the database. But be careful not to replace
homeandsiteurlincorrectly. - Update your sitemap and robots.txt. After the move, resubmit your sitemap to search engines and update any references to the old URLs.
- Use relative URLs in your custom front page. If you create a static HTML front page, use relative links (e.g.,
/blog/) so it works regardless of the domain.
Troubleshooting
- White screen of death. If you see a blank page, check the error log. Common causes: incorrect file permissions (should be 644 for files, 755 for folders) or a corrupted
.htaccess. Restore from backup if needed. - 404 errors on posts/pages. Go to Settings → Permalinks and click “Save Changes� again. If that fails, manually update the
.htaccessfile in theblogfolder with the standard WordPress rewrite rules. - Redirect loop. If
homeandsiteurlare not set correctly, you may get infinite redirects. Double-check the SQL query and ensurehomeis the root URL andsiteurlis the/blogURL. - Login page not working. If you can’t log in, manually edit
wp-config.phpto add the following lines (replace with your URLs):define('WP_HOME','https://yourdomain.com'); define('WP_SITEURL','https://yourdomain.com/blog');This overrides the database values and often fixes login redirect issues.
- Images or assets broken. This usually means the URLs in the database still point to the old location. Use a search-replace plugin to update the domain path in the
wp_poststable (e.g., replacehttps://yourdomain.com/wp-contentwithhttps://yourdomain.com/blog/wp-content).
Frequently Asked Questions
Will my existing posts and pages keep their URLs?
No. After the move, your post URLs will include /blog/ (e.g., example.com/blog/my-post). If you had links pointing to the old URLs, they will break unless you set up redirects. You can use a plugin to redirect old URLs to new ones.
Can I keep my custom front page as a static HTML file instead of a WordPress page?
Yes. You can create a standalone index.html in the root folder. Just make sure it doesn’t conflict with the WordPress index.php (if both exist, the server may prioritize index.php). You can rename the WordPress index.php or use a different method, but the simplest is to use the redirect approach described above.
Do I need to move the .htaccess file?
Yes, move it along with the other WordPress files. The .htaccess in the blog folder handles permalinks for the blog. The root folder may have its own .htaccess if you have other redirects—keep that separate.
What if I’m using a subdomain instead of a subfolder?
The process is similar, but you’d create a subdomain (e.g., blog.example.com) and move WordPress there. The database URL updates would use the subdomain, and the custom front page would be at the main domain. The steps are otherwise the same.
Will this affect my SEO?
It can, if not done correctly. You should set up 301 redirects from old URLs to new ones to preserve link equity. Also update your sitemap and submit it to search engines. With proper redirects, the impact is usually minimal.
Can I undo the move?
Yes, if you have a backup. Simply restore the files and database from your backup. If you want to move back manually, reverse the steps: move files back to the root, update the database URLs (set both home and siteurl to the root), and remove the custom front page setup.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.