Toni Michel Caubet
Toni Michel Caubet

Reputation: 20163

Mobile version redirection via htaccess: redirecting also to PCs?

This is my current redirection:

# redireccion a la version mobile
    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} "ipod|iphone|android|palm|blackberry|googlebot-mobile" [NC]
    RewriteCond %{REQUEST_URI} ^(?!/m/)
    RewriteCond %{REQUEST_URI} ^(?!/inc/)
    RewriteCond %{REQUEST_URI} ^(?!/img/)
    RewriteCond %{REQUEST_FILENAME} !\.(jpg|gif|css|js|png)$
    RewriteRule ^(.*)  /m/$1   [QSA,L,R=301]]

The thing its i just get called because some pc's are seeing the mobile version,

Any idea why?

Thanks!

Upvotes: 1

Views: 139

Answers (1)

anubhava
anubhava

Reputation: 785156

You have some syntax problems in your code.

Can you try this slightly modified code:

RewriteEngine On

RewriteCond %{HTTP_USER_AGENT} "ipod|iphone|android|palm|blackberry|googlebot-mobile" [NC]
RewriteCond %{REQUEST_URI} !^/(m|inc|img)/ [NC]
RewriteCond %{REQUEST_FILENAME} !\.(jpe?g|gif|css|js|png)$
RewriteRule ^(.*)$ /m/$1 [L,R=301]

Upvotes: 1

Related Questions