tags:

views:

48

answers:

2

I'm not familiar with iPhones wants and needs, nor do I have one, but a client wants a screen cap of his site to show up when an iPhone user comes around so I created an .htaccess redirect to an iPhone specific page with this bit of code...

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} iPhone
RewriteCond %{REQUEST_URI} !^/iPhone/
RewriteRule .* /iPhone/ [R]

And the html of the iPhone page...

<html>
<head>
<title>Eatamadedia</title>
</head>
<body style="background-color:#858384;margin:0 auto;">
<img src="../images/iPhonePage.jpg"> 
</body>
</html>

The page redirects just fine, but the .jpg doesn't show up. I can't imagine a simpler page. Anyone know what could be preventing the image from displaying? Does the iPhone require headers?

The site in question is http://eatamedida.com

Thank you in advance for your input. -J

+4  A: 

You're rewrite rule is causing a redirect loop for the images directory. Change it to:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} iPhone
RewriteCond %{REQUEST_URI} !^/iPhone/
RewriteCond %{REQUEST_URI} !^/images/
RewriteRule .* /iPhone/ [R]

In future you can use Firefox with the User Agent Switcher add-on to fake the iPhone user-agent and debug these kinds of issues using Firebug.

roryf
excellent! this user agent switcher is a gold mine!
Jascha
+1  A: 

Well, one of the issues is that the pic on the iPhone page (this one) isn't really suitable for the iPhone's screen resolution. You should consider changing the pic to a 320x480px resolution one.

However, I don't really understand the need for iPhone users to see the site screenshot, anyway.

mcm69
"However, I don't really understand the need for iPhone users to see the site screenshot, anyway." You dare question the clients wants? ;) The site is a flash site, from my understanding, iPhones won't display those. So, the client asked for a redirect to a screenshot.
Jascha
Ah, clients those days...
mcm69