XAMPP (intro to XAMPP) provides a convenient way to quickly and easily install and setup a web server that works without much configuration. However, permalinks feature won’t work with the default installation of XAMPP, even though you can properly customize the permalinks structure to create the .htaccess file.
When you click on any permalinks, your WordPress blog will return a 404 error instead, saying the post not found. Instead, you can only access your blog posts via default permalinks structure, which is in the form of https://techjourney.net/?p=123.
This is because in XAMPP, mod_rewrite is not enable by default. Beside, AllowOverride directive in Apache configuration file is also set to None by default, causing Apache web server to ignore any .htaccess file, which used to rewrite the permalinks to the post’s actual URL.
To use permalinks in WordPress that installed on xampp-based server, edit the httpd.conf that locates in C:\Program Files\xampp\apache\conf directory (folder). Open httpd.conf in any text editor, search for “mod_rewrite”. You should come to a line like this:
#LoadModule rewrite_module modules/mod_rewrite.so
Remove the hash sign (#) from the line. The # indicates the line is not in effect. The changed line should looks like this:
LoadModule rewrite_module modules/mod_rewrite.so
After that, search for “AllowOverride”. You will come to a line like this:
If the above line is contained within default directory (mean the directory declaration is just ), then it can be left as it is. Continue searching and you would come to a second instance of AllowOverride which is contained inside your web server’s document root (default for XAMPP is <directory “c:=”” program=”” files=”” xampp=”” htdocs”=””>in Windows). Change the None to All to make the line looks like this:
Restart the Apache. Permalinks is working after restart.