Answer the question
In order to leave comments, you need to log in
Website in two languages?
Hello.
There is a site in two languages, languages are selected and recorded in cookies, here is the code:
if($lang == "ru") {
setcookie($_COOKIE['lang'], $lang);
} else {
setcookie($_COOKIE['lang'], "ua");
}
header("Location: " . $_SERVER['HTTP_REFERER']);
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteCond %{HTTP:Accept-Language} (ru) [NC]
RewriteRule .* http://mysite.com/ru [R=302,L]
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteRule .* http://mysite.com/ua [R=302,L]
Answer the question
In order to leave comments, you need to log in
So, calmly, there are other things like that too)
So, well, let's start with the fact that everything that comes to any URL that does not exist and to any URL that is not a picture/css/zhs/whatever else is thrown to index.php.
like this:
In .htaccess:
RewriteBase /
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
RewriteRule !\.(js|ico|gif|jpg|png|css|pdf|mov|mp3)$ index.php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question