Back to Blog

Setting up URL Rewrites for WordPress under IIS on a Windows Server

August 18, 2011

By Matt Mombrea
No Comments

A common problem when running WordPress under Windows and IIS is how to handle URL Rewrites. URL Rewrites are usually used with WordPress to format the permalink structure of post URL’s in a nice way, and to remove the need for having index.php in every URL. Apache servers handle this with ease using the widely included mod_rewrite plugin, but unless you’re running IIS 7+ on Windows, you have no such capability without some 3rd party help.

If you’re not already up and running with Rewrites on your Windows Server, download and install ISAPI_Rewite Lite (free), then follow the installation instructions to get going.

Note: If you’re running IIS 7 or greater see the IIS Module and instructions.

The remainder of this post will speak to IIS6.

Now that you have the ISAPI Rewrite module installed, you can use the Helicon Config Editor to make changes to your .htaccess file although you probably won’t need to just yet. The first thing you’ll want to do is to log into your WordPress install and enable the permalink structure you require. This will create an initial, and presumably working, .htaccess file at the root of your install.

  • Log in to the Admin section of your WordPress install by going to http://www.yourdomain/wp-admin
  • Click on Settings -> Permalinks
  • Choose your link structure or enter a custom one

Then click Save to create the rewrite rule. If you get a permission error, you’ll need to grant read/write/execute permission to the account you have PHP running under (i.e. Network Service). Once you are successful, test out your site by navigating to the blog home page and then click on a single post. If it loads and the URL looks like your desired structure, you’re in business.

This process should have resulted in a .htaccess file that looks similar to the following

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

If you run into an issue where your having trouble reaching the wp-admin page after setting up your Rewrite rules, have a look at Correcting wp-admin 404 error for wordpress under IIS.

Matt Mombrea

Matt Mombrea

Matt is a longtime entrepreneur and software engineer. He also sits on the board of Computer Science at SUNY Fredonia. Born and raised in Buffalo, Matt is passionate about building and maintaining great businesses in Buffalo. Apart from leading Cypress North, Matt architects our company’s datacenter, engineers dozens of custom applications, and directs the rest of the development team.

See Matt's Most Recent Posts

Share this post

Leave a Reply

Search our blog

Start A Project

Categories

What's next?

Well...you might like one of these

Article

Is Google Analytics 4 a Tactical Move...

There’s something fishy going on with the way that Google...

Read article

Article

How We Build It: Website Process with...

This month, I sat down with Matt Mombrea, Chief Technical...

Read article

Article

[SOLVED] Using an in-memory repository....

.NET Core Data Protection One of the main benefits of...

Read article