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.soRemove the
#to uncomment it:LoadModule rewrite_module modules/mod_rewrite.so - Allow .htaccess Overrides
Search for theAllowOverridedirective. 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 allChange the line
AllowOverride Noneto:AllowOverride AllThis ensures Apache will read your
.htaccessfile. - Save and Restart Apache
Save thehttpd.conffile 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.