.htaccess - Redirect to a locale based on cookie -
our site uses custom locales. save locale user selects in cookie. how add htaccess file accomplish redirecting proper locale based on cookie? our locales end pre-pending /dallas, /fort-worth , /plano
urls.
<ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule (.+) index.php?p=$1 [qsa,l] </ifmodule>
suppose, set cookie locale=value write .htaccess
rewriteengine on rewritebase / rewritecond %{http_cookie} locale=([^;]+) [nc] rewriterule ^(.*)$ /%1/index.php?p=$1 [nc,l,qsa]
i.e. www.examle.com/smtng.html => www.examle.com/value/index.php?p=smtng.html
Comments
Post a Comment