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://kingphp.com/?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 in Windows). Change the None to All to make the line looks like this:
Restart the Apache. Permalinks is working after restart.