Using the. htaccess Multi-language version of the Web
such as En/ch
Add a PHP link to "EN", click to generate a cookie to do the corresponding jump, the code is as follows
<? PHP Setcookie ("C_language", "en",Time () +31536000, "/"); Header ("location:http://www.website.com");? >
en.php CodeThe. htaccess content is as follows
# # # # Rewrite Browser Germany Language Rewritecond%{http_cookie}!. *c_language.* // non-existent cookierewritecond%{http:accept-language} ^de [NC] // Browser for de language rewriterule ^$ http:///www.website.com/de [r=302,l ]%{http_cookie} ^c _language=de [NC] //cookie for de language rewriterule ^$ http://Www.website.com/de [R=302,l]
. htaccess CodeCode Explanation:
The first entry to the site, there is no c_language, the browser is de language, will open the www.website.com/de/page
First entry to the site, there is no c_language, the browser is EN, will open www.website.com
If the user clicks on the EN/CN toggle button, the C_language cookie will be generated, and if the cookie is DE, enter the www.website.com/de/page. Conversely enter www.website.com
Subsequent user access will be based on the cookie to do the corresponding jump
Overwrite the download file
A, its own server to do the conversion
Rewritecond%{request_uri} download_file_for_.*\.exe$
Rewriterule download_file_for_.*\.exe$ File_setup.exe
B, jump to the CDN download server to do the conversion
Rewritecond%{request_uri} download_file_for_.*\.exe$
Rewriterule ^ (. *) http://cdn.website.com/$1 [l,r=permanent]
Download server:
Rewriteengine on
Rewritecond%{request_filename}!-d
Rewritecond%{request_filename}!-f
Rewriterule download_file_for_.*\.exe$ File_setup.exe
Code explanation
All users download Download_file_for_***.exe files, the file name will be Download_file_for_***.exe, the real file is indeed File_setup.exe