RewriteCond auszuschließen Pfad nicht funktioniert

Möchte ich diese URL:

http://www.example.com/path/antyhing

NICHT umgeleitet werden.

Hier ist, was ich habe, die nicht funktioniert:

RewriteCond %{REQUEST_URI} !^/path/.*$ [NC]
RewriteRule ^ http://m.example.com/[R,L]

Derzeit leitet alle URLs auf http://m.example.com/

Hier ist der vollständige code in meine .htaccess-Datei:

RewriteBase /
RewriteEngine On

# Check if mobile=1 is set and set cookie 'mobile' equal to 1
RewriteCond %{QUERY_STRING} (^|&)mobile=1(&|$)
RewriteRule ^ - [CO=mobile:1:%{HTTP_HOST}]

# Check if mobile=0 is set and set cookie 'mobile' equal to 0
RewriteCond %{QUERY_STRING} (^|&)mobile=0(&|$)
RewriteRule ^ - [CO=mobile:0:%{HTTP_HOST}]

# Skip next rule if mobile=0
RewriteCond %{QUERY_STRING} (^|&)mobile=0(&|$)
RewriteRule ^ - [S=1]

# Check if this looks like a mobile device
RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC,OR]
RewriteCond %{HTTP:Profile}       !^$

# Check if we're not already on the mobile site
RewriteCond %{HTTP_HOST}          !^m\.
# Check to make sure we haven't set the cookie before
RewriteCond %{HTTP:Cookie}        !\mobile=0(;|$)
# Don't redirect "path" pages
RewriteCond %{REQUEST_URI} !^.+?/path/.*$ [NC]
# Now redirect to the mobile site
RewriteRule ^ http://m.example.com/[R,L]
Es sollte funktionieren, aber möglicherweise haben andere Regeln, die in Konflikt mit dieser Regel. Können Sie Ihre aktuellen code aus .htaccess?
danke ich habe den vollständigen code.
Es sieht gut aus. Können Sie versuchen: RewriteCond %{REQUEST_URI} !^/path/ [NC] (ich glaube path geändert werden muss mit dem eigentlichen Seitennamen)
Vielen Dank, leider jeder Seite unter /path/ noch umgeleitet 🙁
Eine Seite Frage, warum haben Sie \mobile statt mobile?

InformationsquelleAutor Community | 2013-09-18

Schreibe einen Kommentar