<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On

  # 配置管理后台地址：访问这个地址会自动跳转到登录页面
  RewriteRule ^manage/?$ /manage/login.html [L,R=302]

  # 语言目录设定

  RewriteCond %{HTTP_HOST} ^local\.hengqiao\.com$ [NC]
  RewriteRule ^ - [E=LANG_DIR:en]

  # 语言目录自动重定向
  RewriteCond %{ENV:LANG_DIR} ^(cn|fr|en)$
  RewriteCond %{REQUEST_URI} !^/%{ENV:LANG_DIR}/ [NC]
  RewriteCond %{DOCUMENT_ROOT}/%{ENV:LANG_DIR}%{REQUEST_URI} -f
  RewriteRule ^(.*)$ /%{ENV:LANG_DIR}/$1 [L]

  # 目录索引处理
  RewriteCond %{ENV:LANG_DIR} ^(cn|fr|en)$
  RewriteCond %{REQUEST_URI} !^/%{ENV:LANG_DIR}/ [NC]
  RewriteCond %{DOCUMENT_ROOT}/%{ENV:LANG_DIR}%{REQUEST_URI} -d
  RewriteCond %{DOCUMENT_ROOT}/%{ENV:LANG_DIR}%{REQUEST_URI}/index.html -f
  RewriteRule ^(.*)$ /%{ENV:LANG_DIR}/$1/index.html [L]

  # 二级目录方式设置
  # 如果目录存在且有 index.html，让 Apache 自然返回
  RewriteCond %{REQUEST_URI} ^/(ru|ja)/ [NC]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteCond %{REQUEST_FILENAME}/index.html -f
  RewriteRule ^(.*)$ /$1/index.html [L]

  RewriteCond %{REQUEST_URI} ^/(ru|ja)/ [NC]
  RewriteCond %{REQUEST_FILENAME} -d
  RewriteCond %{REQUEST_FILENAME}/index.html !-f
  RewriteRule ^(.*)$ /index.php?s=/$1 [QSA,PT,L]

  RewriteCond %{REQUEST_URI} ^/(ru|ja)/ [NC]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ /index.php?s=/$1 [QSA,PT,L]


  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /index.php?s=/$1 [QSA,PT,L]


  SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
</IfModule>


<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/javascript
    <IfModule mod_setenvif.c>
        BrowserMatch ^Mozilla/4 gzip-only-text/html
        BrowserMatch ^Mozilla/4\.0[678] no-gzip
        BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    </IfModule>
    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
</IfModule>

