How a Stale RewriteBase Line in .htaccess Can Break Your WordPress Site
Apache's mod_rewrite module powers WordPress pretty permalinks by silently redirecting clean URLs to index.php using rules stored in the .htaccess file. A critical but often overlooked line, RewriteBase, tells Apache how to resolve relative paths in rewrite rules and is set automatically by WordPress during installation. Problems arise when the server structure changes after installation — such as migrating a subdirectory install to a subdomain — leaving RewriteBase pointing to a path that no longer matches the site's actual location. In one real-world case, moving a WordPress install from a subdirectory under a main domain to a subdomain caused 404 and 500 errors because the RewriteBase value was never updated to reflect the new URL structure. Understanding the distinction between silent internal rewrites and browser-visible redirects, along with keeping RewriteBase accurate, is essential for diagnosing and preventing such failures.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in