Setting up IIRF to redirect to www

So I have been doing some testing on my website and needed to redirect requests to http://chrishammond.com to http://www.chrishammond.com/. Lucky for me the site is using IIRF to manage my urls from the old community server days to my DotNetNuke conversion.

Using IIRF I'm able to create a simple rule that will handle the redirects for me, I've pasted it below.

# force proper www. prefix on all requests
RewriteCond %{HTTP_HOST} ^chrishammond\.com [I]
RewriteRule ^/(.*) http://www.chrishammond.com/$1 [I,RP]

Recent Comments

Comment Avatar

[RP] - ? it's not in the official documentation Where did you get it from ?

Posted By: Furmek F on Mar 2008
Comment Avatar
RP doesn't have any meaning to IIRF. I think it means "redirect permanently" on Helicon's ISAPI rewrite. If you want that in IIRF, just use [R] or combine it with [I] like [I,R].
Posted By: Cheeso C on Jun 2008
Comment Avatar
Hi Chris, I've tried your suggestions above but no joy (I added the changes from the comment above this but still couldn't get it to work) Not sure quite what I'm doing wrong... any ideas? Thanks Simon RewriteCond %{HTTP_HOST} ^mydomain\.co.uk [I] RewriteRule ^/(.*) http://www.mydomain.co.uk/$1 [I,R]
Posted By: Simon Nicol on Oct 2009
Comment Avatar
I'm not actually using IIRF anymore, I use the URLMaster module for DotNetNuke, available from http://www.ifinity.com.au/
Posted By: Chris Hammond on Oct 2009
Comment Avatar
I just figured it out. The rule used is a RewriteRule. To redirect, use RedirectRule instead. RedirectRule ^/(.*) http://www.domaincom/$1 [R=301]
Posted By: Sujay R on Nov 2009

Add Comment

Please add your comment by filling out the field(s) below. Your comment may need to be approved before it becomes visible.
Enter your first name for display with the comment
Enter your last name for display with the comment.
Enter your comment here.
If you can't type DNNRocks in, you can't post, plain and simple.
Submit Comment Cancel

Chris Hammond

Chris Hammond is a father, husband, leader, software developer, photographer and car guy. Chris focuses on the latest in technology including artificial intelligence (AI) and has spent decades becoming an expert in ASP.NET and DotNetNuke (DNN) development. You will find a variety of posts relating to those topics here on the website. For more information check out the about Chris Hammond page.

Find me on Twitter, GitHub and LinkedIn.