Habilitar compresión Gzip en phpBB

Foro sobre phpBB
Responder
Guillermo
Site Admin
Mensajes: 72
Registrado: 13 May 2023, 00:32
Ubicación: Valencia - España
Contactar:

Habilitar compresión Gzip en phpBB

Mensaje por Guillermo »

tags |etiquetas: habilitar compresion gzip, gzip en phpbb, htaccess, optimizar phpbb

Para habilitar la compresión gzip en tu instalación de phpBB, tienes que editar el archivo .htaccess del directorio raíz y añadir las siguientes líneas de código al principio de este archivo de directiva del servidor Apache (probado en esta instalación de phpBB):

Código: Seleccionar todo

## Habilitar compresion
AddOutputFilterByType DEFLATE text/plain text/html
AddOutputFilterByType DEFLATE text/xml application/xml application/xhtml+xml application/xml-dtd
AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml image/svg+xml
AddOutputFilterByType DEFLATE text/css text/javascript application/javascript application/x-javascript
AddOutputFilterByType DEFLATE font/otf font/opentype application/font-otf application/x-font-otf
AddOutputFilterByType DEFLATE font/ttf font/truetype application/font-ttf application/x-font-ttf
:!: NOTA MUY IMPORTANTE: Haz primero una copia de seguridad del archivo .htaccess del servidor. Edita y sube el nuevo con un editor de texto plano.

Más información al respecto:

- Qué es y cómo funciona la compresión gzio: https://indaga.net/que-es-y-como-funcio ... sion-gzip/
- Qué es la compresión gzip: https://www.ionos.es/digitalguide/servi ... -ventajas/
- Cómo comprobar si un sitio tiene habilitada la compresión gzip: http://www.gidnetwork.com/tools/gzip-test.php
Guillermo
Site Admin
Mensajes: 72
Registrado: 13 May 2023, 00:32
Ubicación: Valencia - España
Contactar:

Re: Habilitar compresión Gzip en phpBB

Mensaje por Guillermo »

Adjunto el código de mi archivo .httacess en este color los cambios que por ahora he realizado (compresión gzip y control de errores 404 y 500):

:D ## Habilitar compresion
AddOutputFilterByType DEFLATE text/plain text/html
AddOutputFilterByType DEFLATE text/xml application/xml application/xhtml+xml application/xml-dtd
AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml image/svg+xml
AddOutputFilterByType DEFLATE text/css text/javascript application/javascript application/x-javascript
AddOutputFilterByType DEFLATE font/otf font/opentype application/font-otf application/x-font-otf
AddOutputFilterByType DEFLATE font/ttf font/truetype application/font-ttf application/x-font-ttf


<IfModule mod_rewrite.c>
RewriteEngine on
:D ErrorDocument 404 error.php
ErrorDocument 500 error.php

#
# Uncomment the statement below if URL rewriting doesn't
# work properly. If you installed phpBB in a subdirectory
# of your site, properly set the argument for the statement.
# e.g.: if your domain is test.com and you installed phpBB
# in http://www.test.com/phpBB/index.php you have to set
# the statement RewriteBase /phpBB/
#
#RewriteBase /

#
# Uncomment the statement below if you want to make use of
# HTTP authentication and it does not already work.
# This could be required if you are for example using PHP via Apache CGI.
#
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

#
# The following 3 lines will rewrite URLs passed through the front controller
# to not require app.php in the actual URL. In other words, a controller is
# by default accessed at /app.php/my/controller, but can also be accessed at
# /my/controller
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ app.php [QSA,L]

#
# If symbolic links are not already being followed,
# uncomment the line below.
# http://anothersysadmin.wordpress.com/20 ... pache-228/
#
#Options +FollowSymLinks
</IfModule>

# Apache content negotation tries to interpret non-existent paths as files if
# MultiViews is enabled. This will however cause issues with paths containg
# dots, e.g. for the cron tasks
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>

# With Apache 2.4 the "Order, Deny" syntax has been deprecated and moved from
# module mod_authz_host to a new module called mod_access_compat (which may be
# disabled) and a new "Require" syntax has been introduced to mod_authz_host.
# We could just conditionally provide both versions, but unfortunately Apache
# does not explicitly tell us its version if the module mod_version is not
# available. In this case, we check for the availability of module
# mod_authz_core (which should be on 2.4 or higher only) as a best guess.
<IfModule mod_version.c>
<IfVersion < 2.4>
<Files "config.php">
Order Allow,Deny
Deny from All
</Files>
<Files "common.php">
Order Allow,Deny
Deny from All
</Files>
</IfVersion>
<IfVersion >= 2.4>
<Files "config.php">
Require all denied
</Files>
<Files "common.php">
Require all denied
</Files>
</IfVersion>
</IfModule>
<IfModule !mod_version.c>
<IfModule !mod_authz_core.c>
<Files "config.php">
Order Allow,Deny
Deny from All
</Files>
<Files "common.php">
Order Allow,Deny
Deny from All
</Files>
</IfModule>
<IfModule mod_authz_core.c>
<Files "config.php">
Require all denied
</Files>
<Files "common.php">
Require all denied
</Files>
</IfModule>
</IfModule>
Guillermo
Site Admin
Mensajes: 72
Registrado: 13 May 2023, 00:32
Ubicación: Valencia - España
Contactar:

Re: Habilitar compresión Gzip en phpBB

Mensaje por Guillermo »

Compruebo auditorías con Google PageSpeed Insights tras los cambios:

Auditorías Google PageSpeed
- Móvi: https://pagespeed.web.dev/analysis/http ... tor=mobile
- Ordenador: https://pagespeed.web.dev/analysis/http ... or=desktop
Responder