Link to home
Create AccountLog in
Avatar of swaggerking
swaggerkingFlag for United States of America

asked on

Redirect user to corresponding mobile page based on incoming url

I'm currently running a javascript on my site that redirects some mobile users with specific screen width to my mobile site.  

<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "mysite.com/m/";
}
-->
</script>

Open in new window


I would ideally like to push certain incoming urls (some with parameters) to the corresponding page on the mobile site.

Example:
Incoming url might be:
mysite.com/details.asp?ref=123&prod=foo
I would like to redirect them to:
mysite.com/m/details/?ref=123&prod=foo  

or
mysite.com/videos to mysite.com/m/videos
Avatar of Big Monty
Big Monty
Flag of United States of America image

ideally you would use a url rewriter for this:

for IIS7 - http://www.iis.net/downloads/microsoft/url-rewrite

IIS6 and below - www.isapirewrite.com (free to use)

then you just create a reg exp to determine how the url is redirected
ASKER CERTIFIED SOLUTION
Avatar of nap0leon
nap0leon

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of swaggerking

ASKER

Thanks. That is exactly what I was looking for.