WAP Redirect


Okay. I have been remiss in not learning more about HTTP protocol until now, I admit it. I usually self teach on a need to know basis, and until now, scripts have mostly accomplished whatever I needed to do on a page.

I now understand some rudimentary principles with HTTP Location:header stuff, but apparently not enough to do what I need to do. I want to have cellular phone users and other WAP device users visit http://www.mysite.com and be automatically directed to http://wap.mysite.com.

I have seen some PHP solutions for this, but I didn’t know where in the html document to place it, and if that meant I needed to rename my htm file as a php file. I have only used php before for forms.

Any help at all on this would be greatly appreciated. An idiot-proof step by step explanation will be rewarded by homeade cookies mailed to yer door!




I believe it’s as simple as this…

Give the file a .php extension.
Add this to the top:

<?php // browser detection here if (whatever) { header('Location: http://wap.example.com/'); } ?>

You should include this code (the “header” call, specifically) before any other content is written to the page. (That means the “<?php” bit should be the first line of the file.)


Thanks for responding so quickly, Mark. I will give it a whirl and report back.