Clean URLs for Wordpress When Hosting on Windows Servers

29 November, 2014

Clean URLs for Wordpress When Hosting on Windows Servers

Clean URLs for Wordpress When Hosting on Windows Servers

When hosting a website you have a choice between using Windows or Linux.  Sometimes when hosting on a Windows server you want to use Wordpress on there.  It will work, but it’s not the easiest environment to work with, especially when it comes to URL rewriting rules.  “rewriting rules” are when the URL you see for a page has been made more “pretty” for not only Google but the users as well.  Instead of seeing a post number (for example www.yoursite.com/?page_id=3) this is not the most pretty of ways to see the URL and not the most descriptive too.  You may want to change it to something better.

This is done in Wordpress by changing the Permalink Settings from within the Dashboard.  Sometimes you’ll find though, especially on an existing Wordpress site when you change these settings suddenly your pages won’t be found and you’ll get 404 errors.  This is because the rewriting of the URL is not working.  What you need to do is look to your Web.Config file that should be in your root directory.

Changing the Settings in Web.Config to Make the URLs Work

The first thing to do is to make sure you know where your web.config is, you may find that you don’t even have one in the directory.  Once this is found or you create it (you can do this through Notepad) the key to getting the rewriting to work is to add these conditions into it:

<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=”wordpress” patternSyntax=”Wildcard”>
<match url=”*”/>
<conditions>
<add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true”/>
<add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true”/>
</conditions>
<action type=”Rewrite” url=”index.php”/>
</rule></rules>
</rewrite>
</system.webServer>
</configuration>

There is a lot of jargon in there and things you probably don’t understand but the key is you don’t really need to.  What it basically does is set up a “rule” that says if this is a wordpress request and it’s not a file or directory then add “index.php” to the url in the right position.

Once that has been added to your website make sure it’s still working and everything is still ok.  Once this has been confirmed then go to your Wordpress Dashboard and find your Permalink Settings which you’ll find as a sub menu underneath the general settings.  All you will need to do is select the “permalink” setting which fits how you want your URLs to look like.  You have a few selections so go with the one that fits your needs the most.

These links that look far more informative and prettier than just random numbers will not only make your links look more attractive to users but will also make it easier for search robots to find your website pages.  This is very good for SEO and will help you improve your searchability which is very important for the success of your blog or website.

Author

Arisson Santos

Arisson Santos

Arisson graduated in Computer Science at the University of Wales, and Masters in Advanced Computing at Manchester Metropolitan University both in the UK. He has always been interested in Computers an...

Write a Comment

0 comments

Join the convertation