How to Fix WordPress Permalinks in XAMPP: If your WordPress URLs look like http://localhost/?p=2
instead of clean links like http://localhost/my-post
, it's usually because mod_rewrite
is not enabled or Apache is ignoring your .htaccess
file. The following steps will help you enable permalinks and .htaccess support in XAMPP.
Enable WordPress Permalinks in XAMPP
- Open Apache's Configuration File
Using a text editor (Notepad++, VS Code, etc.), open:
\xampp\apache\conf\httpd.conf
- Enable
mod_rewrite
Search for this line:#LoadModule rewrite_module modules/mod_rewrite.so
Remove the
#
to uncomment it:LoadModule rewrite_module modules/mod_rewrite.so
- Allow .htaccess Overrides
Search for theAllowOverride
directive. You should find a block like this:# AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit AllowOverride None # Controls who can get stuff from this server. Order allow, deny Allow from all
Change the line
AllowOverride None
to:AllowOverride All
This ensures Apache will read your
.htaccess
file. - Save and Restart Apache
Save thehttpd.conf
file and restart Apache from the XAMPP Control Panel. - Update Your WordPress Permalink Settings
Log into your WordPress admin dashboard, go to Settings → Permalinks, choose your preferred permalink structure, and click Save Changes.
That's it! permalinks should now work properly on your local XAMPP installation, and your .htaccess
file will be recognized and used as expected.