Solved

Redirecting URLs with query String

Posted on 2009-05-04
5
1,319 Views
Last Modified: 2013-11-05
Hi,

We have taken over a domain..and we have many URLs hard coded in some mobile devices. We want to keep these URLs working...but we just don't have any luck.  I'm not sure if it is how everything is coded...but when I try with my mobile device with any URL below I just get sent to the last URL in the list.

I'm sure something is wrong with my RedirectMatch... Any ideas?
ServerName mobileportal.mts.ca
    ServerAlias www.mobileportal.mts.ca
 
    RedirectMatch (.*)/getnew\.jsp\?request=default$ http://homepage
    RedirectMatch (.*)/getnew\.jsp\?request=applications$ http://homepage
    RedirectMatch (.*)/getnew\.jsp\?request=facebook $ http://m.facebook.com
    RedirectMatch (.*)/getnew\.jsp\?request=games$ http://homepage
    RedirectMatch (.*)/getnew\.jsp\?request=mms$ http://mmsweb.mts.net
    RedirectMatch (.*)/getnew\.jsp\?request=msn$ http://m.live.com
    RedirectMatch (.*)/getnew\.jsp\?request=picturemail$ http://mmsweb.mts.net
    RedirectMatch (.*)/getnew\.jsp\?request=ProductionMCD$ http://homepage
    RedirectMatch (.*)/getnew\.jsp\?request=quickplay$ http://homepage
    RedirectMatch (.*)/getnew\.jsp\?request=ringers$ http://homepage
    RedirectMatch (.*)/getnew\.jsp\?request=screensavers$ http://homepage
    RedirectMatch (.*)/getnew\.jsp\?request=search$ http://google.ca
    RedirectMatch (.*)/getnew\.jsp\?request=StagingMCD$ http://homepage
    RedirectMatch (.*)/getnew\.jsp\?request=IM%20&%20Email$ http://homepage
    RedirectMatch (.*)/getnew\.jsp\?request=LG550Tetris$ http://homepage
    RedirectMatch (.*)/getnew\.jsp\?request=7050superkoboxing$ http://homepage
    RedirectMatch (.*)/getnew\.jsp$ http://homepage
    RedirectMatch (.*)/facebook$ http://m.facebook.com
    RedirectMatch (.*)/mms$ http://mmsweb.mts.net
    RedirectMatch (.*)/msn$ http://m.live.com
    RedirectMatch (.*)/picturemail$ http://mmsweb.mts.net
    RedirectMatch (.*)/search$ http://google.ca
    RedirectMatch (.*)/ringtones$ http://homepage
 
    RewriteEngine on
    RewriteRule ^/(.*)$ http://www.mts.ca/mobileportal/ [R]

Open in new window

0
Comment
Question by:wpgwiggum
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 24302128
which is the "last URL in the list"?

According your question's title, use the QSA flag in the RewriteRule
0
 
LVL 1

Author Comment

by:wpgwiggum
ID: 24303289
When visiting any page, I always end up at http://www.mts.ca/mobileportal.  When typing www.mobileportal.mts.ca/facebook I would like to get redirected to http://m.facebook.com  but it isn't happening.

Both servers are live at the moment...and can be tried from any browser.
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 500 total points
ID: 24303632
# for your facebook example:

RewriteCond %{REQUEST_URI} ^/*facebook
RewriteRule ^/*facebook(.*) http://m.facebook.com/$1 [QSA,L]
0
 
LVL 1

Author Comment

by:wpgwiggum
ID: 24308286
Thanks, we had to do slight tweaks...but this appears to work for the basic one "/facebook".

We will be trying the same concept for the complicated ones (/getnew.jsp?request=default) and I will post a status as soon as we are done
0
 
LVL 1

Author Comment

by:wpgwiggum
ID: 24337372
We ended up with using the snippet below when we were redirecting based on query string
    RewriteCond %{QUERY_STRING} &?request=default [NC]
    RewriteRule ^(.*) http://homepage/? [L,R]

And the one below for our more basic ones.
    RewriteCond %{REQUEST_URI} /facebook [NC]
    RewriteRule ^(.*) http://m.facebook.com [L,R]
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question