. htaccess Configuration

Source: Internet
Author: User

  1. General WordPress Configuration
    <ifmodule mod_rewrite.c>/^index\.php$-%{request_filename}-%{request_ FILENAME}-/index.php [L]</IfModule># Protect Xmlrpc<files xmlrpc.php>     Order Deny,allow      from All </Files>
    WordPress Code
  2. 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 Code

    The. 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 Code

    Code 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

  3. 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

. htaccess Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.