Answer the question
In order to leave comments, you need to log in
What is the correct way to use mode_rewrite?
Good day
I need to replace URLs like where site.com/...
the site.com/city/...
city value is set in the cookie, I know how you can change the URL in .htaccess for the user, but how to make the logic
if ($_COOKIE['CITY']=1)
{...}
elseif
($_COOKIE['CITY']=2)
{...}...
Answer the question
In order to leave comments, you need to log in
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{HTTP_COOKIE} cookie_name=([^;]+) [NC]
RewriteRule ^(.*)$ http://site.com/%1 [L,R=301]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question