Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

ReWrite Engine Woes

Status
Not open for further replies.
I have something complicated I need to do with my website.

If the user is coming from android or iOS, a GET variable should be added to the URL.



The first part is simple:

RewriteEngine On

RewriteCond %{HTTP_USER_AGENT} (OneMobileUserAgent|AnotherMobileUserAgent|...)
RewriteRule (.*) mobile/$1


This checks for the user agent and sends them somewhere else than where they entered. Changes the URL slightly.



But I need to append a GET variable to this.

I know I could just add "?variable=1" but that is no good because... if it's anything but the first variable there, it needs to use "&variable=1" instead...

I really don't know how to do this.


Basically, if I am on an android device, and I enter the following urls:

http://afar.ws/example.php

It should send me to: http://afar.ws/example.php?device=android

http://afar.ws/example2.php?map=1

It should send me to: http://afar.ws/example2.php?map=1&device=android


Any ideas?


Sorry, I think I've worked out a way to do this through PHP instead which is muh better for me.
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top