problem with cookie

Oh, the strange things mod_rewrite does!

problem with cookie

Postby forearrow » Thu Jul 05, 2007 11:30 pm

dear richardk:

you showed me how to redirect depending on cookie,thank you very much,but I still have problem with this rewrite rule:

Code: Select all
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_COOKIE} ^(.*;\ )?(lang=(en|tw|cn))(;\ .*)?$ [NC]
RewriteRule ^(.+)$ /$1_%2 [QSA,L]


the problem is, when my html page containts image,js or css,they are not able to display,do you have any suggestion?
forearrow
 
Posts: 11
Joined: Fri Apr 27, 2007 10:37 pm

Postby richardk » Fri Jul 06, 2007 6:08 am

The path is wrong? Then you probably have relative paths.

Or they get rewritten too? Then use
Code: Select all
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_COOKIE} ^(.*;\ )?(lang=(en|tw|cn))(;\ .*)?$ [NC]
RewriteRule !\.(jpg|jpeg|css|js)$ %{REQUEST_URI}_%2 [QSA,L]

You can ignore more extensions by adding them into the "()" separated by a "|".
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Idiosyncrasies

Who is online

Users browsing this forum: No registered users and 10 guests

cron