JGuff330
JGuff330

Reputation: 13

htaccess mobile redirect is redirecting on PC

I have my main site (www.jguffphotography.com) currently redirected with htaccess to (mobile.jguffphotography). THAT works fine

I have a directory separately redirected (www.jguffphotography.com/photopage/) to (mobile.jguffphotography.com/photopage)

I have an htaccess file on my main domain, and in the photopage directory.

All is working great from my phone, but on a PC the photopage URLS are redirecting to the mobile sub domain.


The main domain htaccess coding I have is


RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos" [NC]
RewriteRule ^$ http://mobile.jguffphotography.com [L,R=302]

the one I have in the photopage directory is


RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos" [NC]
RedirectMatch 301 ^/photopage/([^.]+).html$ http://mobile.jguffphotography.com/photopage/$1.html

Upvotes: 0

Views: 468

Answers (1)

Jon Lin
Jon Lin

Reputation: 143876

RedirectCond is part of mod_rewrite and applies to a following RewriteRule. RedirectMatch is part of mod_alias and doesn't have anything to do with the previous condition. You need to stick with mod_rewrite:

RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos" [NC]
RewriteRule ^photopage/([^.]+).html$ http://mobile.jguffphotography.com/photopage/$1.html [R=301,L]

Upvotes: 1

Related Questions