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: Rule with exception
Message |

Joined: 30 January 2007
Posts: 20
Posted: 28 December 2010 at 1:37pm


I need to construct a redirection under certain conditions. I have a website we'll say is "". We want the site to never display "www." so it will convert: to

We can do this now using the following code:

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

Problem is, when we work on the site on our development computers, we use a DNS address "". In that case, we DO NOT want it to run that condition. So we need something that works like this:

If NOT "" Then
If "www." Then redirect ""
End If

Sorry I had to add that logic to it, but I figured that's another way of saying what I need. Any help would be GREAT!!!
Back to Top
Admin Group

Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 29 December 2010 at 3:38am

Please try the following:

RewriteCond Host: (?!(?:example\.com|local\.example\.com)).*
RewriteRule (.+) http\://$1 [RP,I]

Back to Top

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