How to make WordPress Permalinks work in Xampp

XAMPP and similar localhost web servers don't have mod_rewrite enabled. Also, the AllowOverride directive is often set to None, which causes Apache to ignore your .htaccess file. This can break WordPress permalinks, leading to "404 Not Found" errors when accessing posts.

If your URLs look like http://localhost/?p=2 instead of clean links like http://localhost/my-post, the following section will help you fix permalinks and enable .htaccess support.

  1. Open Apache’s Configuration File
    Using a text editor (such as Notepad++ or VS Code), open the file:
    \xampp\apache\conf\httpd.conf
  2. 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

  3. Allow .htaccess Overrides
    Search for AllowOverride until you find a section 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 All

    # Controls who can get stuff from this server.
    Order allow,deny
    Allow from all

    Make sure the line reads: AllowOverride All

  4. Save and Restart Apache
    Save the httpd.conf file and restart your Apache server using the XAMPP control panel.
  5. Update Your WordPress Permalink Settings
    Log into your WordPress admin area, go to Settings → Permalinks, choose your desired permalink structure, and click Save Changes.

That’s it! WordPress permalinks should now work properly on your local XAMPP installation. Your .htaccess file will also be recognized and used as expected.