Iphone Rewrite

Discussion in 'Apache' started by carlosgpn, Aug 11, 2009.

  1. #1
    Hi there,

    I'm trying to rewrite some parametes in case the request had came from a Iphone device. Like this:

    www.mysite.com/javaaplication/p.do?url=pg

    if the user-agent have "Iphone" or "Ipod", rewrites to:

    www.mysite.com/javaaplication/p.do?url=pg_iphone

    RewriteCond %{HTTP_USER_AGENT} .*?iPod.*?$ [OR]
    RewriteCond %{HTTP_USER_AGENT} .*?iPhone.*?$

    RewriteRule url=pg$ url=pg_iphone [R] ---> does'nt work

    Could some one help me!?!?

    thanks
     
    carlosgpn, Aug 11, 2009 IP
  2. kulinar

    kulinar Member

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #2
    try this
    RewriteCond %{HTTP_USER_AGENT} ^(.*)ipod(.*)$ [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} ^(.*)iphone(.*)$ [NC]
    RewriteCond %{THE_REQUEST} /(p\.do)\?url=pg\ HTTP/
    RewriteRule ^(p\.do)?$ http://www.mysite.com/javaaplication/p.do?url=pg_iphone? [R=301,L]
    Code (markup):
     
    kulinar, Aug 15, 2009 IP
  3. sacx13

    sacx13 Active Member

    Messages:
    438
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Hey carlo is this configuration working for you ?


    Regards
     
    sacx13, Aug 17, 2009 IP