Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 3.0 support forum
 Helicon Tech : ISAPI_Rewrite 3.0 support forum
Subject Topic: Redirect non-www to www with exception Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
panderson
Newbie
Newbie


Joined: 18 September 2008
Online Status: Offline
Posts: 5
Posted: 18 September 2008 at 10:46am | IP Logged Quote panderson

Great product you have here!!  I have it setup to redirect our site from the non-www to the www but the problem I'm having is it's also trying to redirect our intranet site.  I'm using the free version because we only have one public facing site but was hoping for a way to do the redirect unless the site is 'intranet'.

I'm using the following rule straight from your example page.

RewriteEngine on

#Fix missing trailing slash char on folders
RewriteRule ^([^.?]+[^.?/])$ $1/ [R,L]

#Redirect HTTPS to non-HTTPS
RewriteCond %{HTTP:Host} (.*)
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} (.*)
RewriteRule .? http://%1%2 [R,L]
Back to Top View panderson's Profile Search for other posts by panderson
 
panderson
Newbie
Newbie


Joined: 18 September 2008
Online Status: Offline
Posts: 5
Posted: 18 September 2008 at 5:23pm | IP Logged Quote panderson

I can purchase the full version if that is the only way to do this... it's just one site I need it to not redirect to the www version though.
Back to Top View panderson's Profile Search for other posts by panderson
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Online
Posts: 4837
Posted: 19 September 2008 at 3:06am | IP Logged Quote Anton

Please try to fix your config like this:

RewriteEngine on

#Fix missing trailing slash char on folders
RewriteRule ^([^.?]+[^.?/])$ $1/ [R,L]

#Redirect HTTPS to non-HTTPS
RewriteCond %{HTTP:Host} ((?:www\.)?externalsite\.com)
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} (.*)
RewriteRule .? http://%1%2 [R,L]

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Online
Posts: 4837
Posted: 19 September 2008 at 3:14am | IP Logged Quote Anton

Please try to fix your config like this:

RewriteEngine on

#Fix missing trailing slash char on folders
RewriteRule ^([^.?]+[^.?/])$ $1/ [R,L]

#Redirect HTTPS to non-HTTPS
RewriteCond %{HTTP:Host} ((?:www\.)?externalsite\.com)
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} (.*)
RewriteRule .? http://%1%2 [R,L]

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
panderson
Newbie
Newbie


Joined: 18 September 2008
Online Status: Offline
Posts: 5
Posted: 19 September 2008 at 9:19am | IP Logged Quote panderson

Outstanding... I used your last reply and it seems to be working perfectly.  THANKS!
Back to Top View panderson's Profile Search for other posts by panderson
 
panderson
Newbie
Newbie


Joined: 18 September 2008
Online Status: Offline
Posts: 5
Posted: 19 September 2008 at 10:46am | IP Logged Quote panderson

Argh... I think I spoke to soon.  Let me run down what I'm trying to accomplish to make sure it's clear.  We have a websites domain.com and google has indexed a bunch of pages for https://domain.com and what I would like to do is anybody that goes to domain.com or the secure domain.com gets redirected to the www version.

The rewrite you posted seems to throw it into a loop when I try to go the secure portion of my site at www.domain.com
Back to Top View panderson's Profile Search for other posts by panderson
 
panderson
Newbie
Newbie


Joined: 18 September 2008
Online Status: Offline
Posts: 5
Posted: 19 September 2008 at 12:34pm | IP Logged Quote panderson

OK, I've modified the above to the following so it only does this if the port is 443 since my intranet is not on SSL.  This seems to be working... is there any issues doing it this way?

RewriteEngine on

RewriteCond %{HTTPS} (on)?
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]
Back to Top View panderson's Profile Search for other posts by panderson
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
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 can vote in polls in this forum