• Смотрите, какая красота хорошо чувствовала себя на домашнем Денвере:

    <IfModule mod_charset.c>
    CharsetDisable On
    </IfModule>
    AddDefaultCharset UTF-8
    
    DirectoryIndex index.php
    Options -Indexes
    RewriteEngine On
    
    <files wp-config.php>
    order allow,deny
    deny from all
    </files>
    
    # Follow symbolic links in this directory.
    Options +FollowSymLinks
    
    ErrorDocument 404 /index.php
    
    # Set the default handler.
    DirectoryIndex index.php index.html index.htm
    
    ErrorDocument 404 /
    
    AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4.0[678] no-gzip
    BrowserMatch bMSIE !no-gzip !gzip-only-text/html
    FileETag MTime Size
     <ifmodule mod_expires.c>
    
    <filesmatch "\.(jpg|gif|png|css|js)$">
    ExpiresActive on
    ExpiresDefault "access plus 1 month"
    "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$">
    Order allow,deny
    </filesmatch>
    ExpiresActive on
    ExpiresByType image/jpeg "access plus 3 day"
    ExpiresByType image/gif "access plus 3 day"
    ExpiresByType image/gif A2592000
    ExpiresByType image/png A2592000
    ExpiresByType image/jpg A2592000
    ExpiresByType image/jpeg A2592000
    </ifmodule>
    # BEGIN WPSuperCache
    # END WPSuperCache
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    
    # downloaded.
    RewriteRule "(^|/)\." - [F]
    
    <files *.lic>
    Order Deny,Allow
    Deny From All
    </files>
    <files *.ini>
    Order Deny,Allow
    Deny From All
    </files>
    <files *.tpl>
    Order Deny,Allow
    Deny From All
    </files>
    
    # Rules to correctly serve gzip compressed CSS and JS files.
    # Requires both mod_rewrite and mod_headers to be enabled.
    <IfModule mod_headers.c>
    # Serve gzip compressed CSS files if they exist and the client accepts gzip.
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME}\.gz -s
    RewriteRule ^(.*)\.css $1\.css\.gz [QSA]
    
    # Serve gzip compressed JS files if they exist and the client accepts gzip.
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME}\.gz -s
    RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
    
    # Serve correct content types, and prevent mod_deflate double gzip.
    RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
    RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]
    
    <FilesMatch "(\.js\.gz|\.css\.gz)$">
    # Serve correct encoding type.
    Header set Content-Encoding gzip
    # Force proxies to cache gzipped & non-gzipped css/js files separately.
    Header append Vary Accept-Encoding
    </FilesMatch>
    </IfModule>

    После залива на хостинг, вылезла 500-ая ошибка. Методом тыка был вычислен тот кусок «.htaccess», который её вызывал:

    AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4.0[678] no-gzip
    BrowserMatch bMSIE !no-gzip !gzip-only-text/html
    FileETag MTime Size
     <ifmodule mod_expires.c>
    
    <filesmatch "\.(jpg|gif|png|css|js)$">
    ExpiresActive on
    ExpiresDefault "access plus 1 month"
    "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$">
    Order allow,deny
    </filesmatch>
    ExpiresActive on
    ExpiresByType image/jpeg "access plus 3 day"
    ExpiresByType image/gif "access plus 3 day"
    ExpiresByType image/gif A2592000
    ExpiresByType image/png A2592000
    ExpiresByType image/jpg A2592000
    ExpiresByType image/jpeg A2592000
    </ifmodule>
    # BEGIN WPSuperCache
    # END WPSuperCache

    Пока что оставил весь «.htaccess» с закомментированным проблемным куском. Всё нормально работает, но паранойя не отпускает. Что в нём не то?

Просмотр 2 ответов — с 1 по 2 (всего 2)
Просмотр 2 ответов — с 1 по 2 (всего 2)
  • Тема «Что не так с моим громадным .htaccess?» закрыта для новых ответов.