I have a multi-language website and I want to display the current language in the URI which is something like this:
URI:
www.domain.com/en/
www.domain.com/en/folder1/
www.domain.com/de/
www.domain.com/de/folder2/
DIRECTORY:
public_html/
public_html/folder1/
public_html/
public_html/folder2/
Then the en or de will be saved in a cookie to process the language code.
Is it possible to do these? Even without the actual folder of the en or de?
You can use mod_rewrite to internally rewrite the URI to remove the language and use the
COflag to set a cookie. So something like this (in the htaccess file in your document root):This will set a cookie named lang with the value equal to the 2 letter prefix in the original URI and with the domain as domain.com.