# ==================================================
# MEDIPET - SEGURIDAD Y OPTIMIZACION
# ==================================================
Options -Indexes
ErrorDocument 403 default
ErrorDocument 404 default
# Proteger archivos sensibles
Require all denied
RewriteEngine On
# Permitir validaciones SSL
RewriteCond %{HTTP_HOST} ^(www\.)?medipet\.com\.ec$ [NC]
RewriteRule ^\.well-known/ - [L]
# Bloqueo IP anterior
RewriteCond %{HTTP_HOST} ^(www\.)?medipet\.com\.ec$ [NC]
RewriteCond %{REMOTE_ADDR} ^157\.100\.141\.74$
RewriteRule ^ - [F,L]
# Bloquear ejecucion PHP en uploads
RewriteCond %{HTTP_HOST} ^(www\.)?medipet\.com\.ec$ [NC]
RewriteRule ^wp-content/uploads/.*\.(php[0-9]*|phtml|phar)(/|$) - [F,L,NC]
# Proteger respaldos de UpdraftPlus
RewriteCond %{HTTP_HOST} ^(www\.)?medipet\.com\.ec$ [NC]
RewriteRule ^wp-content/updraft(/|$) - [F,L,NC]
# Proteger archivos de Wordfence antiguos
RewriteCond %{HTTP_HOST} ^(www\.)?medipet\.com\.ec$ [NC]
RewriteRule ^wp-content/wflogs(-old)?(/|$) - [F,L,NC]
# Proteger repositorios privados
RewriteCond %{HTTP_HOST} ^(www\.)?medipet\.com\.ec$ [NC]
RewriteRule (^|/)\.git(/|$) - [F,L,NC]
# Proteger copias de wp-config
RewriteCond %{HTTP_HOST} ^(www\.)?medipet\.com\.ec$ [NC]
RewriteRule ^wp-config\.php\..+$ - [F,L,NC]
# ==================================================
# PROTECCION CONTRA ESCANEOS PHP
# ==================================================
# Rechazar archivos PHP inexistentes sin cargar WP
RewriteCond %{HTTP_HOST} ^(www\.)?medipet\.com\.ec$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.php$ - [R=404,L,NC]
# ==================================================
# BOTS DE RASTREO AGRESIVO
# ==================================================
RewriteCond %{HTTP_HOST} ^(www\.)?medipet\.com\.ec$ [NC]
RewriteCond %{HTTP_USER_AGENT} (AhrefsBot|SemrushBot|DotBot|MJ12bot|BLEXBot|DataForSeoBot|PetalBot|Bytespider|MegaIndex|serpstatbot|ZoominfoBot|AspiegelBot|AwarioSmartBot) [NC]
RewriteRule ^ - [F,L]
# ==================================================
# PROTECCION HOTLINK
# ==================================================
# Permitir imagenes sin referer y todos los
# subdominios autorizados de Medipet
RewriteCond %{HTTP_HOST} ^(www\.)?medipet\.com\.ec$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^https?://([a-z0-9-]+\.)*medipet\.com\.ec(:[0-9]+)?(/|$) [NC]
RewriteRule \.(jpg|jpeg|gif|png|bmp|webp)$ - [F,L,NC]
# ==================================================
# WP ROCKET - CACHE ORIGINAL
# ==================================================
# BEGIN WP Rocket v3.10.2
# Use UTF-8 encoding for anything served text/plain or text/html
AddDefaultCharset UTF-8
# Force UTF-8 for a number of file formats
AddCharset UTF-8 .atom .css .js .json .rss .vtt .xml
Header unset ETag
FileETag None
Header set X-Powered-By "WP Rocket/3.10.2"
Header unset Pragma
Header append Cache-Control "public"
Header unset Last-Modified
Header unset Pragma
Header append Cache-Control "public"
AddType image/avif avif
AddType image/avif-sequence avifs
# Expires headers
ExpiresActive on
ExpiresDefault "access plus 1 month"
ExpiresByType text/cache-manifest "access plus 0 seconds"
ExpiresByType text/html "access plus 0 seconds"
ExpiresByType text/xml "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType application/json "access plus 0 seconds"
ExpiresByType application/rss+xml "access plus 1 hour"
ExpiresByType application/atom+xml "access plus 1 hour"
ExpiresByType image/x-icon "access plus 1 week"
ExpiresByType image/gif "access plus 4 months"
ExpiresByType image/png "access plus 4 months"
ExpiresByType image/jpeg "access plus 4 months"
ExpiresByType image/webp "access plus 4 months"
ExpiresByType video/ogg "access plus 4 months"
ExpiresByType audio/ogg "access plus 4 months"
ExpiresByType video/mp4 "access plus 4 months"
ExpiresByType video/webm "access plus 4 months"
ExpiresByType image/avif "access plus 4 months"
ExpiresByType image/avif-sequence "access plus 4 months"
ExpiresByType text/x-component "access plus 1 month"
ExpiresByType font/ttf "access plus 4 months"
ExpiresByType font/otf "access plus 4 months"
ExpiresByType font/woff "access plus 4 months"
ExpiresByType font/woff2 "access plus 4 months"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
# Gzip compression
SetOutputFilter DEFLATE
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
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
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
Header append Vary: Accept-Encoding
AddType text/html .html_gzip
AddEncoding gzip .html_gzip
SetEnvIfNoCase Request_URI \.html_gzip$ no-gzip
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} on [OR]
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} https
RewriteRule .* - [E=WPR_SSL:-https]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule .* - [E=WPR_ENC:_gzip]
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP:Cookie} !(wordpress_logged_in_.+|wp-postpass_|wptouch_switch_toggle|comment_author_|comment_author_email_) [NC]
RewriteCond %{REQUEST_URI} !^(/(.+/)?feed/?.+/?|/(?:.+/)?embed/|/(index\.php/)?wp\-json(/.*|$)|/access2022pet5/)$ [NC]
RewriteCond %{HTTP_USER_AGENT} !^(facebookexternalhit).* [NC]
RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/wp-rocket/%{HTTP_HOST}%{REQUEST_URI}/index%{ENV:WPR_SSL}%{ENV:WPR_WEBP}.html%{ENV:WPR_ENC}" -f
RewriteRule .* "/wp-content/cache/wp-rocket/%{HTTP_HOST}%{REQUEST_URI}/index%{ENV:WPR_SSL}%{ENV:WPR_WEBP}.html%{ENV:WPR_ENC}" [L]
# END WP Rocket
# ==================================================
# WORDPRESS
# ==================================================
# BEGIN WordPress
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
# ==================================================
# CPANEL PHP
# ==================================================
# php -- BEGIN cPanel-generated handler, do not edit
# This domain inherits the “PHP” package.
# php -- END cPanel-generated handler, do not edit