This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Force proper www prefix on requests
Author
Message |
monsteruk
Newbie


Joined: 26 November 2010
Location: United Kingdom
Posts: 2
Posted: 26 November 2010 at 6:41am

All,

Had a search and could not find this covered elsewhere, so here goes...

I am using ISAPI Rewrite on IIS 6 (Windows 2003), and want to force people to use the full "www" prefix when coming to the site.

So, if someone comes with the following URL:

http://test.com/MyPage.htm

I want to re-write the request to this...

http://www.test.com/MyPage.htm

I searched on the web and found what was supposed to be a solution, but when I tried it, it gave an error and I could not get to any pages served at all!  Hence I took it out.

This is what I started with...

# force proper www. prefix on all requests

RewriteCond %HTTP_HOST ^test\.com

RewriteRule ^/(.*) http://www.test.com/$1 [RP]

Which I tried, but it did not work.  Unfortuantley, rules and regular expressions are not my bag, so I was hoping someone could provide a working sample to solve my problem!

Many thanks in advance...

Roy



__________________
Perfect florida villas for vacation rental.
Back to Top Visit monsteruk's Homepage
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 29 November 2010 at 2:39am

Please try to apply the following config:

# force proper www. prefix on all requests
RewriteCond Host: test\.com
RewriteRule (.*) http\://www.test.com$1 [RP]

__________________
Regards,
Anton
Back to Top
 
monsteruk
Newbie


Joined: 26 November 2010
Location: United Kingdom
Posts: 2
Posted: 30 November 2010 at 3:28am

That did the trick!  Many thanks for the suggestion!

Regards,

Roy



__________________
Perfect florida villas for vacation rental.
Back to Top Visit monsteruk's Homepage
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum