Skip to content

24 ways to impress your friends

Vote up?

Sripathi Krishnan


More info on the redirect to sub-domain approach :

Step 1 : The first trick is to use WURFL ( WURFL is a database that maps user agent strings to device capabilities. This means you can figure out the device or browsers aspect ratio server side on the first request.

Step 2 : Next, figure out how many different image resolutions you want to support, and then create a sub-domain for each resolution. Typical would be mobile, tablet, wired etc. But you are free to create as many sub-domains you want.

Step 3 : Then, redirect the user to the appropriate sub-domain on the first request.

Step 4 : Finally, in Apache, create virtual hosts for each sub-domain. So Apache will serve both and from different folders. No PHP required. Also, since the URL is unique, you can put strong cache headers.