[wp-hackers] Mobile version using a plugin

Chetan Kunte ckunte at gmail.com
Sat Jan 26 00:24:07 GMT 2008


Hi -

I'm trying to write a simple plugin on the lines of Matt's no-www (
http://photomatt.net/2006/06/13/wordpress-no-www/ ).

For a site: mysite.com, the idea is to make m.mysite.com redirect to:

http://www.google.com/reader/m/view/feed/http://mysite.com/feed/atom

But it doesn't seem to work. Appreciate if someone could take a look
at the code below and tell me what's wrong with it:

<?php

if ( !strstr( $_SERVER['HTTP_HOST'], 'm.' ) )
return;

header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.google.com/reader/m/view/feed/' .
substr($_SERVER['HTTP_HOST'], 2) . 'feed/atom');
exit();

?>

Thanks,
-- 
Chetan, ckunte.com


More information about the wp-hackers mailing list