0

I search about mobile direction via htaccess file; and find somethings.. thats ok.. But, i couldnt implement to my recent .htaccess file.. (its not working)

do you have any idea; what should i do?

my recent htaccess file starts with these lines:

Options -Indexes
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

(i add www line for SEO; to make www.site.com and site.com the same..)

now; iam doing it via php and javascript as like this:

<?
$adres = "http://".$_SERVER['HTTP_HOST']."".$_SERVER['REQUEST_URI']."";
$mobileadres = str_replace("http://www", "http://mobile",$adres);
?>
<script type="text/javascript">
if (screen.width <= 810) {
    window.location = "<? echo $mobileadres; ?>";
  }
</script>

could you help me to do this via .htaccess file?

user3283814
  • 35
  • 1
  • 5
  • It's not possible to test `screen.width` from `.htaccess` – Croises Dec 08 '14 at 14:58
  • i dont want to do it via javascript; (i did the example below, because i couldnt do it via htaccess) i want to do redirection via my htaccess file.. – user3283814 Dec 08 '14 at 15:11
  • I read that. But It's not possible to test `screen.width` from `.htaccess`. You can test `user_agent`... : http://stackoverflow.com/questions/3680463/mobile-redirect-using-htaccess?rq=1 – Croises Dec 08 '14 at 15:21

0 Answers0