WordPress Custom Permalink not Working in Localhost

A friend of mine working in localhost and when he try to change the permalink structure to a custom permalink or to any other permalink and unfortunately all his site pages goes to 404 error page not found and he could only access the default permalink structure which is e.g. http://localhost/?p=1, this time I will try to explain why it happen and give you possible solution.

Okay, let’s start.

The reason why it happen is because Apache module mod_rewrite and AllowOverride directive are both disable by default and if you change permalink structure, WordPress use .htaccess files and in order for .htaccess to work properly you need to enable Apache module and AllowOverride directive that is usually set to none.


Method 1:

Step 1:

Start the server you’re using in your wordpress installation, this tutorial I’m using WAMP server, if you’re use XAMP or any other server don’t worry folks the solution is the same.

After you start the server you will now see green icon directly right beneath the taskbar, if you didn’t see it click show hidden icons to show more icons, see below.

Step 2:

Click the green icon and select Apache -> httpd.conf, it will open httpd.conf in notepad.

Step 3:

And now the httpd.conf is open in notepad, press Ctrl + F to search, type mod_rewrite.so in the text field.
You notice that the line has hash “#” on the left side; now all you need to do is remove the hash



Now search AllowOverride until you reach something similar below.

Change the above lines to these.

After changing those lines above, now save the file.

Step 4:

In order the changes to take effect you need to restart services, to do that click the green icon or the WAMP server icon and click Restart All Services, wait for a few seconds until the green icon back to its original color.

Method 2:

Now instead of editing httpd.conf which is quite long method will do just check the module we want to enable and it’s pretty easy.

Select Apache –> Apache Modules –> and that will display the lists of available modules now just check rewrite_module

That’s it and you’re done.

Thanks to jhezer for pointing this method.


That’s it, change the permalink structure again and refresh your site.

Let me know if you’re in any trouble, use the comment box below to add your thoughts.

by Ryan Sutana

  • simple way : select apache – apache modules – and ceklist rewrite_module

  • Hi @JhezeR, yeah thanks for pointing that, I forgot that method, I will add it in the list.

  • Ramanjit singh


  • junaid

    thank u v much

  • itswinner

    i am reading so may solution but all are useless
    your solution is relay help me thankssssss

    • I’m glad it helps 🙂

  • Jaffer

    Excellent .. changed my life and saved my time

  • Hitesh

    HI Ryan
    Having gone through so many posts..that did not work for my installation. Thank you for a clear and definitive solution that works. Wishing you well.