.htaccess Set Cookie and redirect based on Cookie value
$30-40 USD
Paid on delivery
A way is needed to modify the .htaccess file for [url removed, login to view] to set a cookie for a language and then if the user visits [url removed, login to view], redirect to the correct page based on the cookie language.
Example:
A user goes to [url removed, login to view] or [url removed, login to view] and a cookie "lang" is set with value "es". There is a subdirectory and language files inside for each language on [url removed, login to view] like [url removed, login to view] [url removed, login to view], [url removed, login to view]
If user has "lang" cookie value "es", and clicks link "[url removed, login to view]" then .htaccess will direct to "[url removed, login to view]"
Notes:
1. If a language file is missing, just default to english (do not redirect, just show the page requested like [url removed, login to view])
2. Must work with or without www and https.
3. Must not need to put a .htaccess file in each language subdirectory
4. Will not break pages that link to something like [url removed, login to view] (must hard code acceptable language codes in the .htaccess)
Setting cookie example:
RewriteBase /
RewriteRule ^(.*)(en|fr|de|ru)/$ - [co=lang:$2:.[url removed, login to view]:/]
Redirect based on cookie example:
RewriteBase /
RewriteCond %{HTTP_COOKIE} lang=([^;]+) [NC]
RewriteRule ^(.*)$ /$1?lang=%1 [NC,L,QSA]
## Deliverables
Must work on Apache/CentOS
Project ID: #2789933