Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Closed Thread
 
Thread Tools Display Modes
Share |
  #1  
Old 03-17-2015, 08:27 AM
searchbliss's Avatar
searchbliss searchbliss is offline
v7n Mentor
 
Join Date: 03-25-06
Location: USA
Posts: 1,676
iTrader: 1 / 100%
Web.config redirect help! Need a regex guru for this one

I currently have a rewrite rule in my web.config that points all my pages to a mobile domain when using a phone:
Code:
<rule name="MobileRedirect" patternSyntax="ECMAScript" stopProcessing="true"> <match url=".*" ignoreCase="true" /> <conditions logicalGrouping="MatchAll"> <add input="{HTTP_USER_AGENT}" pattern="iPhone|iPod|blackberry|android...etc" /> </conditions> <action type="Redirect" url="http:// searchbliss.powered .mobi" appendQueryString="false" redirectType="Found" /> </rule>
The problem is, every page gets redirected to the mobile homepage. What I need is a to redirect every page to its mobile page. For example:
searchbliss.com/seo-tools/keyword-tools.htm
TO
searchbliss.powered.mobi/?ContentPath=http://www.searchbliss.com/seo-tools/keyword-tools.htm
And so on...
None of the regular expression patters and conditions I've tried do the trick. Any ideas? Thanks.
 

Advertisement

Advertisement

  #2  
Old 03-21-2015, 01:33 PM
searchbliss's Avatar
searchbliss searchbliss is offline
v7n Mentor
 
Join Date: 03-25-06
Location: USA
Posts: 1,676
iTrader: 1 / 100%
Please, any ideas??? It's very frustration.
 
  #3  
Old 03-21-2015, 08:33 PM
J. H. Rasmussen J. H. Rasmussen is offline
Super Moderator
 
Join Date: 11-11-11
Location: Copenhagen, Denmark
Posts: 5,998
iTrader: 1 / 100%
I have tested this on IIS 6.0 and it seems to work like you want it to:
Code:
<rule name="MobileRedirect" patternSyntax="ECMAScript" stopProcessing="true"> <match url="^(.+)" /> <conditions> <add input="{HTTP_USER_AGENT}" pattern="iPhone|iPod|blackberry|android" /> </conditions> <action type="Redirect" url="http://searchbliss.powered.mobi/?ContentPath=http:%2F%2F{HTTP_HOST}%2F{UrlEncode:{REQUEST_URI}}" appendQueryString="false" redirectType="Found" /> </rule>
 
  #4  
Old 03-22-2015, 06:52 AM
searchbliss's Avatar
searchbliss searchbliss is offline
v7n Mentor
 
Join Date: 03-25-06
Location: USA
Posts: 1,676
iTrader: 1 / 100%
Thank you! It didn't work at first, but when I changed the match url pattern to .* it now works perfectly. Thank you, thank you, thank you!!!
 
  #5  
Old 03-22-2015, 07:17 AM
J. H. Rasmussen J. H. Rasmussen is offline
Super Moderator
 
Join Date: 11-11-11
Location: Copenhagen, Denmark
Posts: 5,998
iTrader: 1 / 100%
You are welcome, glad you got it working
 
Go Back   Webmaster Forum > Web Development > Coding Forum

Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex Help in Ruby? jemagee Coding Forum 0 09-18-2012 07:30 AM
Regex question, maybe even easier equityPHP Coding Forum 3 10-12-2011 02:28 AM
Any regex experts? DrDave Coding Forum 4 08-29-2011 07:37 AM
Regex.. kos Coding Forum 3 01-19-2011 04:46 PM
Quick Regex Help Leon Coding Forum 1 08-18-2009 02:06 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 11:03 AM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC