Невозможно редактировать .htaccess без ошибки сервера. 500 сообщение для веб-мастера. - PullRequest
0 голосов
/ 27 января 2019

Я пытался переместить заголовки gzip и кеша в начало файла перед запуском wp rocket, и это не сработало, даже просто изменив стирание двух пустых строк между комментариями, что привело к ошибке сервера, даже без изменения данных, которые я пытался изменить, где вызывается gzipВ статье .htaccess говорится о размещении gzip и заголовков кэша наверху.Мой начинается с настроек ракеты wp, и я не могу поставить gzip ни до, ни после, либо после wp rocket noteven после wordpress, или даже после того, как двойная клятва htaccess не отображается внизу, но выдает ошибку все время, независимо от того, что вы меняете.Я даже попытался стереть 2 пустые строки между комментариями, что там, где они были пустыми, я не изменил никаких данных, и это выдало ошибку 500, точно так же, как когда вмешивается htaccess.Теперь у меня есть брандмауэр cloudflare и защита от ddos, плюс css, html и js minification и async, работающие с cloudflare и wp rocket, и даже у меня есть autoptimize для 7 файлов, которые другие не откладывают.Все эти кэши, включая opcache и pagepeed, собираются.

Что защищает htacess, мне удалось изменить его, прежде чем я не смогу больше.

# BEGIN WP Rocket v3.2.3.1
# Use UTF-8 encoding for anything served text/plain or text/html
AddDefaultCharset UTF-8
# Force UTF-8 for a number of file formats
<IfModule mod_mime.c>
AddCharset UTF-8 .atom .css .js .json .rss .vtt .xml
</IfModule>

# FileETag None is not enough for every server.
<IfModule mod_headers.c>
Header unset ETag
</IfModule>

# Since we’re sending far-future expires, we don’t need ETags for static content.
# developer.yahoo.com/performance/rules.html#etags
FileETag None

<IfModule mod_alias.c>
<FilesMatch "\.(html|htm|rtf|rtx|txt|xsd|xsl|xml)$">
<IfModule mod_headers.c>
Header set X-Powered-By "WP Rocket/3.2.3.1"
Header unset Pragma
Header append Cache-Control "public"
Header unset Last-Modified
</IfModule>
</FilesMatch>

<FilesMatch>(css|htc|js|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz| gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$">
<IfModule mod_headers.c>
Header unset Pragma
Header append Cache-Control "public"
</IfModule>
</FilesMatch>
</IfModule>


# Force deflate for mangled headers
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ 
^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept- 
Encoding
# Don’t compress images and other uncompressible content
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|rar|zip|exe|flv|mov|wma|mp3|avi|swf|mp? 
g|mp4|webm|webp|pdf)$ no-gzip dont-vary
</IfModule>
</IfModule>

# Compress all output labeled with one of the following MIME-types
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE application/atom+xml \
                              application/javascript \
                              application/json \
                              application/rss+xml \
                              application/vnd.ms-fontobject \
                              application/x-font-ttf \
                              application/xhtml+xml \
                              application/xml \
                              font/opentype \
                              image/svg+xml \
                              image/x-icon \
                              text/css \
                              text/html \
                              text/plain \
                              text/x-component \
                              text/xml
</IfModule>
<IfModule mod_headers.c>
Header append Vary: Accept-Encoding
</IfModule>
</IfModule>

# END WP Rocket

# PH pagespeed start
<IfModule pagespeed_module>
ModPagespeed on
ModPagespeedRewriteLevel PassThrough
ModPagespeedEnableFilters 


 </IfModule>
 # PH pagespeed end
 #PH auth start
 ErrorDocument 401 default
<FilesMatch "^((wp-login)\.php|(xmlrpc)\.php|(admin-ajax)\.php)$">
AuthType Basic
AuthUserFile /home/punkmmur/.htpasswd
 AuthName "Double Authentification PlanetHoster"
require valid-user
</FilesMatch>
#PH auth end
# 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

#Expires cache end
# BEGIN Cache-Control Headers
<IfModule mod_expires.c>
<IfModule mod_headers.c>
<filesMatch "\.(ico|jpe?g|png|gif|swf)$">
  Header append Cache-Control "public"
</filesMatch>
<filesMatch "\.(css)$">
  Header append Cache-Control "public"
</filesMatch>
<filesMatch "\.(js)$">
  Header append Cache-Control "private"
</filesMatch>
<filesMatch "\.(x?html?|php)$">
  Header append Cache-Control "private, must-revalidate"
</filesMatch>
</IfModule>
</IfModule>
# Disable ETags
<IfModule mod_headers.c>
Header unset ETag
</IfModule>
  FileETag None
php_value upload_max_filesize 200M
php_value post_max_size 200M

# Gzip compression
FileETag MTime Size
# Gzip compression
# Active compression
SetOutputFilter DEFLATE
#Activation du Mod Deflate
#Activation du Mod Deflate
<IfModule mod_deflate.c>
# Compresse les fichiers HTML, CSS, JavaScript, Text, XML et les fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Ce code est pour assurer une compatibilité avec les anciens 
 navigateurs
 BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>

#Activation du mod Expires
#Customize expires cache start - adjust the period according to your 
 needs

  # Expires headers (for better cache control)
  #Activation du mod Expires
    #Customize expires cache start - adjust the period according to 
  your 
  needs

    # Expires headers (for better cache control)
  <IfModule mod_expires.c>
  FileETag MTime Size
  ExpiresActive on
    # Perhaps better to whitelist expires rules? Perhaps.
    ExpiresDefault                              "access plus 1 month"
    # cache.appcache needs re-requests in FF 3.6 (thanks Remy 
    ~Introducing HTML5)
    ExpiresByType text/cache-manifest           "access plus 1 month"
    # Your document html
    ExpiresByType text/html                     "access plus 1 month"
    # Data
    ExpiresByType text/xml                      "access plus 1 month"
    ExpiresByType application/xml               "access plus 1 month"
    ExpiresByType application/json              "access plus 1 month"
    # Feed
    ExpiresByType application/rss+xml           "access plus 1 hour"
    ExpiresByType application/atom+xml          "access plus 1 hour"
    # Favicon (cannot be renamed)
    ExpiresByType image/x-icon                  "access plus 1 week"
    # Media: images, video, audio
    ExpiresByType image/gif                     "access plus 1 year"
    ExpiresByType image/png                     "access plus 1 year"
    ExpiresByType image/jpeg                    "access plus 1 year"
    ExpiresByType image/webp                    "access plus 1 year"
    ExpiresByType video/ogg                     "access plus 1 year"
    ExpiresByType audio/ogg                     "access plus 1 year"
    ExpiresByType video/mp4                     "access plus 1 year"
    ExpiresByType video/webm                    "access plus 1 year"
    # HTC files  (css3pie)
    ExpiresByType text/x-component              "access plus 1 month"
    # Webfonts
    ExpiresByType application/x-font-ttf        "access plus 1 year"
    ExpiresByType font/opentype                 "access plus 1 year"
    ExpiresByType application/x-font-woff       "access plus 1 year"
    ExpiresByType application/x-font-woff2      "access plus 1 year"
    ExpiresByType image/svg+xml                 "access plus 1 year"
    ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
    # CSS and JavaScript
    ExpiresByType text/css                      "access plus 1 month"
  ExpiresByType text/javascript               "access plus 1 month"
    ExpiresByType application/javascript        "access plus 1 month"
    # Others
    ExpiresByType application/pdf "access plus 1 month"
    ExpiresByType application/x-shockwave-flash "access plus 1 month"
    </IfModule>

 # BEGIN ShortPixelWebp

 # END ShortPixelWebp
...