PHP: Best redirect technique
<p>I'm currently using the excellent mobile detection script from: detectmobilebrowsers.mobi</p>

<p>This works really well however, it redirects every and any page on your main site (including any query parameters) to your mobile site's home page.</p>

<p>What I need is:</p>

<p><a href="http://www.mydomain.com/page.php?var1=X&amp;var2=Y" rel="nofollow">http://www.mydomain.com/page.php?var1=X&amp;var2=Y</a></p>

<p>to direct to:</p>

<p><a href="http://mobile.mydomain.com/page.php?var1=X&amp;var2=Y" rel="nofollow">http://mobile.mydomain.com/page.php?var1=X&amp;var2=Y</a></p>

<p>I have multiple pages that should redirect with the query string to their mobile versions.</p>

<p>What's the best way to approach this? I thought that I should:</p>

<p>Examine the $_SERVER['HTTP_REFERER'] for the page and query string, use a switch/case to loop through the 10 or so pages that I need matching on the main and mobile sites then change the referer URL in the mobile detection script.</p>

<p>Does this make sense?</p>

<p>I've been struggling to get the page and query... any advise and thoughts welcome.</p>
