Redirection site mobile sauf 1 page -> impossible
Bonjour à tous,
Je galère sur un problème qui me semble pourtant simple.
J'ai un site web sous Zend Framework dont la règle de base est la suivante :
Code:
1 2 3 4 5 6
|
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L] |
Une version mobile du site a été faites et j'ai donc inséré avant la règle suivante qu'on m'a transmise :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
# Ignore images requests
RewriteCond %{REQUEST_FILENAME} !\.(png|jpg|gif)$
# Check if this looks like a mobile device
RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC,OR]
RewriteCond %{HTTP:Profile} !^$
RewriteCond %{HTTP_HOST} ^([a-z0-9-]+).monsite.com [NC]
# Now redirect to the mobile site
RewriteRule (.*) <a href="http://%1.monsite.mobi" target="_blank">http://%1.monsite.mobi</a> [R,L] |
Jusque là tout va bien.
Puis arrive une nouvelle demande concernant l'url /xxx/yyy.html qui ne doit jamais être redirigé et toujours affiché sur le site web et donc jamais sur la partie mobile.
J'ai donc au final le fichier suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
# ----- MOBILE -----
# Ignore images requests
RewriteCond %{REQUEST_FILENAME} !\.(png|jpg|gif)$
# Ignore request
RewriteCond %{REQUEST_URI} !^/xxx/yyy.html$
# Check if this looks like a mobile device
RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC,OR]
RewriteCond %{HTTP:Profile} !^$
RewriteCond %{HTTP_HOST} ^([a-z0-9-]+).monsite.com [NC]
# Now redirect to the mobile site
RewriteRule (.*) <a href="http://%1.monsite.mobi" target="_blank">http://%1.monsite.mobi</a> [R,L]
# ----- REGLES DE BASE ZEND -----
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L] |
La règle ne fonctionne pas. Si j'enlève les règles Zend, cela semble fonctionner (tout le site est redirigé sur la partie mobile sauf l'url xxx/yyy.html) mais bien sur la partie web ne fonctionne plus.
Du coup, je ne vois pas ce qui cloche, est-ce quelqu'un pourrait m'apporter quelques lumières ?
Merci beaucoup :)