ISAPI Rewrite Tips - 301 Moved Permanently Redirect



Rewrite Tip 1 - Redirect Sub-Domain to Domain

For those of you utilizing an ISAPI filter for URI rewriting, here is a quick tip on setting up a 301 Moved Permanently rule for http://example.com/ to http://www.example.com/.

RewriteCond Host: ^example\.com
RewriteRule (.*) http\://www\.example\.com$1 [I,RP]

Just drop the above rule into your local httpd.ini file (ctrl + click to grab the above code). No longer do you need to get your hosting provider involved when setting up 301 Moved Permanently redirects.

Be sure to always check your Server Headers to verify that the correct HTTP Status Codes are being returned.

Rewrite Tip 2 - Redirect Old Page to New Page

Here is an example of redirecting an old-page.asp to a new-page.asp...

RewriteRule /old-page.asp http://www.example.com/new-page.asp [I,O,RP,L]

Just drop the above code in your local httpd.ini file (ctrl + click to grab the above code).

Order ISAPI Rewrite for IIS ISAPI Rewrite is a powerful URL manipulation engine based on regular expressions. It acts mostly like Apache's mod_Rewrite, but it is designed specifically for Microsoft Internet Information Server (IIS).

ISAPI Rewrite is an ISAPI filter written in pure C/C++ so it is extremely fast. ISAPI Rewrite gives you the freedom to go beyond standard URL schemes and develop your own scheme.

ISAPI Definition: Internet Server Application Program Interface


 


SEO Consultants Directory