I am working on a .NET based mobile site (m.website.com). I am using IIRF on the main site (non-mobile) for URL rewriting.
Now, it is required to redirect any mobile user to the mobile site if they land up on the main site (www.website.com). I am able to achieve this by checking the user agent in IIRF and redirecting.
The issue I'm facing is that:
The mobile site will have a link back to the main site. If a mobile user clicks on this link then he should not be redirected back to the mobile device.
I tried to follow the htaccess solution mentioned in this post - Mobile Redirect using htaccess but its not working properly with IIRF. RewriteCond
for {QueryString}
is not working properly. Also, I am not sure if I can set a cookie from IIRF itself, the way its mentioned in the link.
I have been struggling with this issue for quite a few hours, it would be great if someone could help.
Another approach I tried was checking the HTTP_REFERER
to avoid redirection if the referring site is the mobile site but that did not work as well.
IIRF does not offer the
[co]
modifier to set a cookie - but you should be able to do that easily from within .NET.IIRF however supports checking for cookie values by using
{HTTP_COOKIE}
in your conditions.{QUERY_STRING}
is also supported (just make sure to include the underscore). Also, it'sHTTP_REFERER
, notHTTP_REFERRER
(a misspelling we'll have to live with...).You could therefore adapt the rewrite rules based on the user agent (where does that list come from??) from the question you linked. Redirect to the mobile site if:
?noredirect=1
or similar)