0

i have complete a mobile site and now i want to this site to in ipod/iphone like mobile device and now i got a document .htaccess file to in the site. This following is the code for htaccess file

RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]

now i have the html file index.html of my mobile site and i want the code for user agent detection. but, i cant know where the file can be added.

can i add this file by php code in the html file.

Thanks

now i saved the .htaccess filre in the subdirectory and i cant get any affect to my site.

Rain
  • 141
  • 1
  • 2
  • 12
  • Take a look at this: [stackoverflow.com/questions/9421577/best-way-to-redirect-mobile-devices][1] [1]: http://stackoverflow.com/questions/9421577/best-way-to-redirect-mobile-devices – Bjørne Malmanger Mar 16 '12 at 19:45
  • 1
    `.htaccess` files are put in the directory that they should affect. – Jasper Mar 16 '12 at 19:48
  • i want where i can add the above code in my site – Rain Mar 16 '12 at 19:49
  • Just put the code inside a text-document, and name it `.htaccess` (so no name, just the extension). Put this file in the same directory as `index.html` and `mobiledirectoryhere` are in. – Gerben Mar 16 '12 at 20:51
  • ok thanks. now i want this mobile version works only in those mobile device and when it is open in desktop it open another site's url. – Rain Mar 17 '12 at 05:27

0 Answers0