Serving pages to cell phones

If you are bored on the train, never fear! Ugly, slow-loading websites on your cell-phone to the rescue! Seriously, kids. You can make a portable version of your website so easily.

Basically, you make the pages (index.wml) and throw them up. Easy, right? Below is a sample wml:

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="c1" title="Thomas J. Webb" >
        <p>
        <a href="news.wml.php">blog</a>
        </p>
</card>
</wml>

Most webmasters like to put the WAP version of the site in a different subdomain (such as wap.yahoo.com), but I don’t know why they bother. We have a wonderful thing in Apache called content negotiation. Throw everything up there and let the webserver sort it out. First, enable multi-views in httpd.conf:

MultiViews on

Then set the directory index as simply index. This way, the webserver selects from index.html (or index.php or whatever) for regular browsers and index.wml for cell-phone browsers.

DirectoryIndex index

Another higher-performance alternative to MultiViews is to simply use a .var file for the index. See Apache’s documentation for details…

携帯のサイト

つまらなくて電車に乗ってる時、つまらないサイトを見られる。楽しいね!まじめに小さいバージョンを作りやすいだよ。

まず、index.wmlを作ってアップロードして。やさしいね。

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="c1" title="Thomas J. Webb" >
        <p>
        <a href="news.wml.php">blog</a>
        </p>
</card>
</wml>

ウェブマスタはほとんどサブドメーンを作る。たとえばwap.yahoo.com。でも、何でか分かんねえ。ApacheのContent Negotiationはスーパーである。サーバは頭が言い。まずhttpd.confにコレを入れて。

MultiViews on

すると、始め見るページがindexにさせて。サーバはindex.htmlとindex.wmlの中に決心出来る。

DirectoryIndex index

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>