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: Rewrite with excemptions how to
Author
Message |
dougwilki
Newbie


Joined: 28 October 2010
Posts: 18
Posted: 28 October 2010 at 11:02am

I have a rewritecond for a specific domain were it redirects all traffic for that doamin to a url for a 3rd party (usablenet) that handles the mobile site. I would like to exclude specific directory or pages from going to the usablenet mobile site and go directly to the full version site version of page or directory bypassing the mobile site.

mobile site = http\://mobile.domain.com/mt/www.domain.com

non mobile site = http://www.domain.com/twitter/

 

 

RewriteCond Host: ((?:www\.)?domain\.com)
RewriteCond User-Agent: (?:.*Android.*|.*AU-MIC.*|.*AUDIOVOX.*|.*Alcatel.*|.*BlackBerry.*|.*Blazer.*|.*Danger\shiptop.*|.*DoCoMo/.*|.*Ericsson.*|.*Googlebot-Mobile.*|.*MSN\sMobile\sProxy.*|.*Handheld.*|.*iPhone.*|.*iPod.*|.*Klondike.*|.*LG-.*|.*LGE-.*|.*\sLGE\s.*|.*MOT-.*|.*NetFront.*|.*Nokia.*|.*Opera\sMini.*|.*PalmOS.*|.*PalmSource.*|.*Panasonic-.*|.*SAGEM-.*|.*SAMSUNG.*|.*SGH-.*|.*SHARP-.*|.*SIE-.*|.*Samsung-.*|.*Smartphone.*|.*Sony.*|.*Symbian\sOS.*|.*Windows\sCE.*|.*WebOS.*|.*nokia.*|.*portalmmm.*|.*Profile/MIDP-.*|.*UP\.Link.*|.*UP\.Browser.*)
RewriteCond User-Agent: (?!.*UsableNet).*
RewriteRule (.*) http\://mobile.domain.com/mt/www.domain.com [I,L,R]

Back to Top
 
dougwilki
Newbie


Joined: 28 October 2010
Posts: 18
Posted: 28 October 2010 at 1:16pm

Resolve by adding this code to the beginning:

RewriteRule (.*)^/deals/twitter/.* $0 [I,L]

 

Back to Top
 
dougwilki
Newbie


Joined: 28 October 2010
Posts: 18
Posted: 01 November 2010 at 2:37pm

OK so I resolved the initial issue. Have a new one.

I need an exemption and then that exemption redirected to another url like: Not sute if this would work?

#exemptions from mobile site _ URL's bypass the mobile redirect

RewriteRule (.*)^/deals/twitter/.* $ http\://otherdomain/folder/ [I,L]

and/or

RewriteRule http://domain1/about/test.html $ http://domain2/about/test2.html [I,L]

 

Your  help will be greatly appreciated.

 

Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 02 November 2010 at 4:55am

Not sure with the correct syntax.
What is the input and output URLs you need to apply?

Regards
Andrew
Back to Top
 
dougwilki
Newbie


Joined: 28 October 2010
Posts: 18
Posted: 02 November 2010 at 10:55am

I would like to setup two redirects that bypass the mobile code above like exemptions:

redirect 1:

input = http://www.domain.com/about

output = http://www.domain2.com/about

rewrite would look something like ( not sure of the syntax):

RewriteRule (.*)^/about(/.*)? http://www.domain2.com/about [I,RP]

Also by pass the mobile redirect code above.

Second redirect:

input = https://checkin.domain1.com/B6WebCheckIn/WebCheckIn.html

output =

https://mobile.domain2.com/mt/checkin.jetblue.com/mobile/B6/Locate.jsp

 

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 03 November 2010 at 5:14am

The rules for you will be:

RewriteCond Host: (?:www\.)?domain\.com
RewriteRule /about(/.*)? http\://www.domain2.com/about(?1$1) [I,RP]

RewriteCond Host: checkin\.domain1\.com
RewriteCond %HTTPS (?!off).*
RewriteRule /B6WebCheckIn/WebCheckIn\.html https\://mobile.domain2.com/mt/checkin.jetblue.com/mobile/B6/Locate.jspt [I,RP]

__________________
Regards,
Anton
Back to Top
 
dougwilki
Newbie


Joined: 28 October 2010
Posts: 18
Posted: 03 November 2010 at 3:59pm

RewriteCond Host: (?:www\.)?domain\.com
RewriteRule /about(/.*)? http\://www.domain2.com/about(?1$1) [I,RP]

This works, but how do I exlude it do it only affect in the Mobile redirect part and not on the hole redirect file ? So it only redirects on a mobile device and not on a regular browser.

Many thanks for you help.

 

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 04 November 2010 at 2:28am

I guess it should be like this:

RewriteCond User-Agent: (?:.*Android.*|.*AU-
MIC.*|.*AUDIOVOX.*|.*Alcatel.*|.*BlackBerry.*|.*Blazer.*|.*Danger\shiptop.*|.*DoCoMo/.*|.*Ericsson.*|.*Googlebot-
Mobile.*|.*MSN\sMobile\sProxy.*|.*Handheld.*|.*iPhone.*|.*iPod.*|.*Klondike.*|.*LG-.*|.*LGE-.*|.*\sLGE\s.*|.*MOT-
.*|.*NetFront.*|.*Nokia.*|.*Opera\sMini.*|.*PalmOS.*|.*PalmSource.*|.*Panasonic-.*|.*SAGEM-.*|.*SAMSUNG.*|.*SGH-.*|.*SHARP-.*|.*SIE-
.*|.*Samsung-.*|.*Smartphone.*|.*Sony.*|.*Symbian\sOS.*|.*Windows\sCE.*|.*WebOS.*|.*nokia.*|.*portalmmm.*|.*Profile/MIDP-
.*|.*UP\.Link.*|.*UP\.Browser.*)
RewriteCond Host: (?:www\.)?domain\.com
RewriteRule /about(/.*)? http\://www.domain2.com/about(?1$1) [I,RP]

__________________
Regards,
Anton
Back to Top
 
dougwilki
Newbie


Joined: 28 October 2010
Posts: 18
Posted: 04 November 2010 at 10:05am

Soory about the confusion, let me explain and thanks again for you help.

This what I currently use for mobile devices and need to keep using. This code rediects any mobile device that hits anyhting whatever.com to the mobile site on usablenet:

______________________________________________________________

RewriteCond Host: ((?:www\.)?whatever\.com)
RewriteCond User-Agent: (?:.*Android.*|.*AU-MIC.*|.*AUDIOVOX.*|.*Alcatel.*|.*BlackBerry.*|.*Blazer.*|.*Danger\shiptop.*|.*DoCoMo/.*|.*Ericsson.*|.*Googlebot-Mobile.*|.*MSN\sMobile\sProxy.*|.*Handheld.*|.*iPhone.*|.*iPod.*|.*Klondike.*|.*LG-.*|.*LGE-.*|.*\sLGE\s.*|.*MOT-.*|.*NetFront.*|.*Nokia.*|.*Opera\sMini.*|.*PalmOS.*|.*PalmSource.*|.*Panasonic-.*|.*SAGEM-.*|.*SAMSUNG.*|.*SGH-.*|.*SHARP-.*|.*SIE-.*|.*Samsung-.*|.*Smartphone.*|.*Sony.*|.*Symbian\sOS.*|.*Windows\sCE.*|.*WebOS.*|.*nokia.*|.*portalmmm.*|.*Profile/MIDP-.*|.*UP\.Link.*|.*UP\.Browser.*)
RewriteCond User-Agent: (?!.*UsableNet).*
RewriteRule (.*) http\://mobile.whatever.com/mt/www.whatever.com [I,L,R]

____________________________________________________________

Explanation of enviroment:

Some client get emails from us that have regular site link, not mobile. The current regular site has links for images that point to FQDN within whatever.com. If a client opens an email it would always redirect back to the mobile site due to the code above.

What I tried:

I tried first an exemption, this worked fine the issue was the links in the page redirect back to FQDN wahtever.com and redirecting back to the mobile site, this created issues with images not loading since going via usablenet:

RewriteRule (.*)^/about.* $0 [I,L]

What I need to acomplish:

We have anothe copy of the site that is has images pointing locally and not using the domain name whatever.com.

If client get link in email. they would be to regular site/domain whatever.com. I need to use the mobile code above + have a redirect exemption what goes from the regular site/domain link and the redirects to the secondary site/domain that has images locally linked.

Somehing like:

Keep in ming $1 = whatver.com

RewriteRule (.*)^/about(/.*)? http\://mobile2/about(?1$2) [I,RP]

If I enable this code it redirect for the hole redirect file not specific to the mobile code above.

Back to Top
 
dougwilki
Newbie


Joined: 28 October 2010
Posts: 18
Posted: 04 November 2010 at 10:15am

last explanation:

If i am a client on mobile device. I get redirected to the usablenet mobile site.

If i get an email on my mobile device ( promotions only). it should go to the regular site but it redirects to the mobile site due to the mobile redirect code.

If I get a promotion email on my mobile device, I should be able to go to the reular site, but since the images links point to FQDN (bad design) it would always redirect back for images to usablenet and images would fail.

If i get an email with promotion on mobile device. I should open the email see a link to the regular site. Detect that I am a mobile device and load the regular site page redirect to the secondary site that has local images.

Whatever.com/about    to    whatever2.com/about

This should not affect users using regular browser only mobile users.

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 05 November 2010 at 6:14am

It's becoming more and more complicated...
And your explanation does not make it any clearer...

So, some guidelines first:
- You can detect whether mobile or regular user requests the site using RewriteCond User-Agent: statement.
- You may try to identify if the image is requested from email by checking if Referer value is empty (though that doesn't ensure 100% result).

And another suggestion:
I guess it would be easier to work with some existing config you have.
Show the entire config that is running now and comment what is working as expected and what needs to be fixed and in what way.

__________________
Regards,
Anton
Back to Top
 
dougwilki
Newbie


Joined: 28 October 2010
Posts: 18
Posted: 08 November 2010 at 11:56am

Last attempt at this:

********** Code used to Redirect Mobile Devices to mobile.fly.com via usablenet*************************

RewriteCond Host: ((?:www\.)?fly\.com)
RewriteCond User-Agent: (?:.*Android.*|.*AU-MIC.*|.*AUDIOVOX.*|.*Alcatel.*|.*BlackBerry.*|.*Blazer.*|.*Danger\shiptop.*|.*DoCoMo/.*|.*Ericsson.*|.*Googlebot-Mobile.*|.*MSN\sMobile\sProxy.*|.*Handheld.*|.*iPhone.*|.*iPod.*|.*Klondike.*|.*LG-.*|.*LGE-.*|.*\sLGE\s.*|.*MOT-.*|.*NetFront.*|.*Nokia.*|.*Opera\sMini.*|.*PalmOS.*|.*PalmSource.*|.*Panasonic-.*|.*SAGEM-.*|.*SAMSUNG.*|.*SGH-.*|.*SHARP-.*|.*SIE-.*|.*Samsung-.*|.*Smartphone.*|.*Sony.*|.*Symbian\sOS.*|.*Windows\sCE.*|.*WebOS.*|.*nokia.*|.*portalmmm.*|.*Profile/MIDP-.*|.*UP\.Link.*|.*UP\.Browser.*)
RewriteCond User-Agent: (?!.*UsableNet).*
RewriteRule (.*) http\://mobile.fly.com/mt/www.fly.com [I,L,R]

************************************************************************************************************************************************
Issue 1:

Clients get emails for Promotions.

The promo links are pointing to www.fly.com

This means that due to the code above anything that has fly.com redirect to the mobile site in usablenet (http\://mobile.fly.com/mt/www.fly.com)

I would like to have the email with link to promotions that client receive by past usablenet and go direclty to www.fly.com

If i make an exemption like RewriteRule (.*)^/deals/twitter/.* $0 [I,L] the main page loads but all image links are poiting back to FQDN to www.fly.com\images so it is going back to the redierct for usablenet above and the images do not load correclty.

I would like to redirect to the WWW.fly.com page bypass the usablenet with exemption and then redirect to the mobile2 site url witch does not have www.fly.com FQDN and would not redirect via usablenet.

Something like:

RewriteRule (.*)^/about(/.*)? http\://mobile2/about(?1$2) [I,RP]

This works but I get an error "to many redirect"

Issue 2:

Client receive an email to chekcing with a link https://checkin.fly.com/B6WebCheckIn/WebCheckIn.html

This link requires java plugin, does not work on mobile devices.

we have a non java link https://mobile.fly.com/mt/checkin.jetblue.com/mobile/B6/Locate.jsp via usablenet.

I would like to redirect client that receive the email via mobile device from the java version url to the non-java.

 


 

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 09 November 2010 at 3:31am

Let's try to have the following config:

RewriteCond Referer: ^$
RewriteCond Host: (?:www\.)?fly\.com
RewriteRule .* $0 [I,L]

RewriteCond Host: (?!.*(?:www\.)?fly\.com.*).*
RewriteRule /about(/.*)? http\://mobile2/about(?1$1) [I,RP]

RewriteCond Host: checkin\.fly\.com
RewriteCond %HTTPS (?!.*off.*).*
RewriteRule /B6WebCheckIn/WebCheckIn\.html https\://mobile.fly.com/mt/checkin.jetblue.com/mobile/B6/Locate.jsp [I,RP]

__________________
Regards,
Anton
Back to Top
 
dougwilki
Newbie


Joined: 28 October 2010
Posts: 18
Posted: 09 November 2010 at 10:10am

This change made the fly.com unavaliable. I have refer to sending clients emails with one link for mobile and one for non-mobile.

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 10 November 2010 at 2:22am

"This change made the fly.com unavaliable."
- how did you test it? What was the request? What result did you get and what you expected to get?

__________________
Regards,
Anton
Back to Top
 
dougwilki
Newbie


Joined: 28 October 2010
Posts: 18
Posted: 10 November 2010 at 8:47am

I belive this code made fly.com unavalible:

RewriteCond Referer: ^$
RewriteCond Host: (?:www\.)?fly\.com
RewriteRule .* $0 [I,L]

__________________________________________________________

********** Code used to Redirect Mobile Devices to mobile.fly.com via usablenet*************************

RewriteCond Host: ((?:www\.)?fly\.com)
RewriteCond User-Agent: (?:.*Android.*|.*AU-MIC.*|.*AUDIOVOX.*|.*Alcatel.*|.*BlackBerry.*|.*Blazer.*|.*Danger\shiptop.*|.*DoCoMo/.*|.*Ericsson.*|.*Googlebot-Mobile.*|.*MSN\sMobile\sProxy.*|.*Handheld.*|.*iPhone.*|.*iPod.*|.*Klondike.*|.*LG-.*|.*LGE-.*|.*\sLGE\s.*|.*MOT-.*|.*NetFront.*|.*Nokia.*|.*Opera\sMini.*|.*PalmOS.*|.*PalmSource.*|.*Panasonic-.*|.*SAGEM-.*|.*SAMSUNG.*|.*SGH-.*|.*SHARP-.*|.*SIE-.*|.*Samsung-.*|.*Smartphone.*|.*Sony.*|.*Symbian\sOS.*|.*Windows\sCE.*|.*WebOS.*|.*nokia.*|.*portalmmm.*|.*Profile/MIDP-.*|.*UP\.Link.*|.*UP\.Browser.*)
RewriteCond User-Agent: (?!.*UsableNet).*
RewriteRule (.*) http\://mobile.fly.com/mt/www.fly.com [I,L,R]

************************************************************************************************************************************************

Not sure were to place the code at the beginninng or the end of the usablenet code above.

This one has to redirect from source to target as an exemption to the usablenet code above and does not affects anyting else before or after that has the domain name fly.com. It only affects the code for usablenet above.Would only be affecting mobile devices.

Source: http://www.fly.com/about    target:http://mobile2/about/

This one has to redirect from source to target as an exemption to the usablenet code above and does not affects anyting else before or after that has the domain name fly.com. It only affects the code for usablenet above. Notice that the target is usablenet again. Would only be affecting mobile devices.

Source: https://checkin.fly.com/B6WebCheckIn/WebCheckIn.html

Target: https://mobile.fly.com/mt/checkin.fly.com/mobile/B6/Locate.jsp

 

 

 

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 11 November 2010 at 2:05am

Ok, let's try to put it all togehter in the following order:

RewriteCond Host: checkin\.fly\.com
RewriteCond %HTTPS (?!.*off.*).*
RewriteRule /B6WebCheckIn/WebCheckIn\.html https\://mobile.fly.com/mt/checkin.jetblue.com/mobile/B6/Locate.jsp [I,RP]

RewriteCond Host: (?:www\.)?fly\.com
RewriteCond User-Agent: (?:.*Android.*|.*AU-
MIC.*|.*AUDIOVOX.*|.*Alcatel.*|.*BlackBerry.*|.*Blazer.*|.*Danger\shiptop.*|.*DoCoMo/.*|.*Ericsson.*|.*Googlebot-
Mobile.*|.*MSN\sMobile\sProxy.*|.*Handheld.*|.*iPhone.*|.*iPod.*|.*Klondike.*|.*LG-.*|.*LGE-.*|.*\sLGE\s.*|.*MOT-
.*|.*NetFront.*|.*Nokia.*|.*Opera\sMini.*|.*PalmOS.*|.*PalmSource.*|.*Panasonic-.*|.*SAGEM-.*|.*SAMSUNG.*|.*SGH-.*|.*SHARP-.*|.*SIE-
.*|.*Samsung-.*|.*Smartphone.*|.*Sony.*|.*Symbian\sOS.*|.*Windows\sCE.*|.*WebOS.*|.*nokia.*|.*portalmmm.*|.*Profile/MIDP-
.*|.*UP\.Link.*|.*UP\.Browser.*)
RewriteCond User-Agent: (?!.*UsableNet).*
RewriteRule (.*) http\://mobile.fly.com/mt/www.fly.com [I,RP]

RewriteCond Referer: ^$
RewriteCond Host: (?:www\.)?fly\.com
RewriteRule /about(/.*)? http\://mobile2/about(?1$1) [I,RP]


__________________
Regards,
Anton
Back to Top
 
dougwilki
Newbie


Joined: 28 October 2010
Posts: 18
Posted: 11 November 2010 at 2:00pm

Tried this does not work. Chekin or about do not redirect.
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 12 November 2010 at 4:34am

Let's give this a try:

RewriteCond Host: checkin\.fly\.com
#RewriteCond %HTTPS (?!.*off.*).*
RewriteRule /B6WebCheckIn/WebCheckIn\.html https\://mobile.fly.com/mt/checkin.jetblue.com/mobile/B6/Locate.jsp [I,RP]

RewriteCond Host: (?:www\.)?fly\.com
RewriteCond User-Agent: (?:.*Android.*|.*AU-
MIC.*|.*AUDIOVOX.*|.*Alcatel.*|.*BlackBerry.*|.*Blazer.*|.*Danger\shiptop.*|.*DoCoMo/.*|.*Ericsson.*|.*Googlebot-
Mobile.*|.*MSN\sMobile\sProxy.*|.*Handheld.*|.*iPhone.*|.*iPod.*|.*Klondike.*|.*LG-.*|.*LGE-.*|.*\sLGE\s.*|.*MOT-
.*|.*NetFront.*|.*Nokia.*|.*Opera\sMini.*|.*PalmOS.*|.*PalmSource.*|.*Panasonic-.*|.*SAGEM-.*|.*SAMSUNG.*|.*SGH-.*|.*SHARP-.*|.*SIE-
.*|.*Samsung-.*|.*Smartphone.*|.*Sony.*|.*Symbian\sOS.*|.*Windows\sCE.*|.*WebOS.*|.*nokia.*|.*portalmmm.*|.*Profile/MIDP-
.*|.*UP\.Link.*|.*UP\.Browser.*)
RewriteCond User-Agent: (?!.*UsableNet).*
RewriteRule (.*) http\://mobile.fly.com/mt/www.fly.com [I,RP]

#RewriteCond Referer: ^$
RewriteCond Host: (?:www\.)?fly\.com
RewriteRule /about(/.*)? http\://mobile2.fly.com/about(?1$1) [I,RP]

__________________
Regards,
Anton
Back to Top
 
dougwilki
Newbie


Joined: 28 October 2010
Posts: 18
Posted: 12 November 2010 at 9:44am

Still do dice...does not work, no redirect
Back to Top
 

Page of 2 Next >>
 
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