301 Redirect on Windows Server & IIS Using ISAPI Rewrite

Posted By on Feb 13, 2013


With every new website I take on I am encountered with a new challenge. This time it was implementing a series of 301 redirects from the old urls of a website to the corresponding new urls of the newly designed website. The website is hosted with irishdomains.com on an windows starter 5 server. The new site was built using WordPress.

It is important to apply 301 redirects after changes to a website from an SEO point of view as it transfers the SEO value of the old URL directly to the new URL. Also from a user experience point of view it avoids people clicking on broken links from other websites that link to yours.

Usual a 301 redirect can be done on a WordPress website using a simple plugin, however these only work on Linux/Apache based web servers so s I have little knowledge of windows web servers or ISPAI this was particularly challenging but eventually I figured it out.

The Challenge
Redirect www.website/contact.htm to www.website.com/contact using a 301 redirect.

Solution
Open a new file in a text editor (notepad) and paste the following code in:

[ISAPI_Rewrite]

# === ISAPI 301 redirect example ===

RewriteEngine On

RewriteRule /contact\.htm /contact/ [RP]

Save the file as “httpd.ini” and upload it to the root using an ftp client like FileZilla. Please note that before you create the file you will need to enable ISAPI_Rewrite support on your web server. This is done through your hosting control panel.

The [RP] (permanent redirect) flag in the code issues the all important 301 (moved permanently) HTTP status code. For more info on the meaning of the code see http://www.isapirewrite.com/docs/

Submit a Comment

Shares
Share This