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
Author
Message |
ballmatic
Newbie


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

Hello,

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

http://www.example.com to http://example.com

We can do this now using the following code:

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

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

If NOT "local.example.com" Then
If "www." Then redirect "http://example.com"
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
 
Anton
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\://example.com$1 [RP,I]

__________________
Regards,
Anton
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