Fix custom permalinks structure in WordPress on a localhost setup

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
March 1, 2011

It is always a good idea to test your WordPress installation on localhost before putting it live. Using XAMPP or WAMP, you can easily setup a server on your computer and test your WordPress Blog. This helps you to fix the issues that arise before you put your blog live. But there sure are some demerits of testing a blog on localhost; if you are planning to install plugins that connect with other online services, your wordpress test blog running on your local server may not function well or may be too sluggish. There is also an issue with custom permalink structures which don’t happen to work on localhost on default settings. Here is how you can use custom permalinks issue in WordPress when testing it on localhost.

When you install WordPress on an online server, you should set the proper file permissions for the native wordpress folders. Your .htaccess file should be writable for changes in WordPress and also for some plugins to function. But on your computer, you don’t have such options for setting the CHMOD values. After changing the default permalink structure to some custom SEO friendly structure like /%category%/%postname%/, WordPress makes certain changes in the .htaccess file. If the file cannot be edited by WordPress, your custom permalink structure won’t work and you’ll get a message on WordPress saying that the URL you looked for wasn’t found in the server. So, to do this, you’ll need to modify a file inside your WAMP folder. Browse to “WAMP\bin\apache2.2.17\conf” and locate the file httpd.conf. Open it with a text editor like Notepad.  The path to this file may differ slightly based on the version of your WAMP installation; so simply search for “ttpd.conf” inside the WAMP folder. On your text editor, use the search function to locate the following line.

#LoadModule rewrite_module modules/mod_rewrite.so

Remove the “#” symbol from this line. “#” is a comment syntax used in the file. Removing this will uncomment the line and make it work.

Now again use the search function to locate the line which appears as follows.

<Directory />
Options FollowSymLinks
AllowOverride none
Order deny,allow
Deny from all
</Directory>

Here, change AllowOverride None to AllowOverride All as follows.

<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>

Remember that “AllowOverride none” appears at two places within your code. Just edit the one within <Directory/>and not within <Directory “cgi-bin”>

Finally save your file. Now restart all services from the WAMP server controls. And try opening a page on your localhost; it should open perfectly without showing the “Not Found” error. You can fix the WordPress custom permalink issue in XAMPP in similar way by editing the file httpd.conf inside XAMPP installation directory.

You may also like...

Post a comment