Categorías
Wordpress

¿Cómo proteger wordpress con .htaccess


RewriteEngine On
RewriteCond %%{HTTPS} off
RewriteRule (.*) https://%%{HTTP_HOST}%%{REQUEST_URI} [R=301,L]

#STRICT TRANSPORT Y PERMISION POLICY
<IfModule mod_headers.c>
Header set Strict-Transport-Security "max-age=31536000; preload" env=HTTPS
Header always set Content-Security-Policy "upgrade-insecure-requests"
Header always set X-Content-Type-Options "nosniff"
Header always set X-XSS-Protection "1; mode=block"
Header always set Expect-CT "max-age=7776000, enforce"
Header always set Referrer-Policy: "no-referrer-when-downgrade"
Header always set Permissions-Policy "geolocation=(); midi=();notifications=();push=();sync-xhr=();accelerometer=(); gyroscope=(); magnetometer=(); payment=(); camera=(); microphone=();usb=(); xr=();speaker=(self);vibrate=();fullscreen=(self);"
Header always append X-Frame-Options SAMEORIGIN
</IfModule>

#BLOQUEO ACCESO AL wp-config.php
<files wp-config.php>
order allow,deny
deny from all
</files>

# SECURE LOOSE FILES
# http://m0n.co/04
<IfModule mod_alias.c>
RedirectMatch 403 (?i)(^#.*#|~)$
RedirectMatch 403 (?i)/readme\.(html|txt)
RedirectMatch 403 (?i)\.(ds_store|well-known)
RedirectMatch 403 (?i)/wp-config-sample\.php
RedirectMatch 403 (?i)\.(7z|bak|bz2|com|conf|dist|fla|git|inc|ini|log|old|psd|rar|tar|tgz|save|sh|sql|svn|swo|swp)$
</IfModule>

# BLOQUEO SPAM NO REFERIDO
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %%{REQUEST_METHOD} POST
RewriteCond %%{HTTP_USER_AGENT} ^$ [OR]
RewriteCond %%{HTTP_REFERER} !^http(s)?://([^.]+\.)?{HTTP_HOST}\.com [NC]
RewriteCond %%{REQUEST_URI} /wp-comments-post\.php [NC]
RewriteRule .* - [F,L]
</IfModule>

#BLOQUEAR CRAWLERS INDESEADOS
RewriteCond %%{HTTP_USER_AGENT} (VelenPublicWebCrawler|Baiduspider|magpie-crawler|CCBot|okhttp|GPTBot) [NC]
RewriteRule .* - [R=403,L]


<IfModule mod_expires.c>
ExpiresActive on

# Por defecto 1 mes de caché
ExpiresDefault "access plus 1 month"
# El HTML nunca debe de ser cacheado, así como los datos dinámicos
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/ld+json "access plus 0 seconds"
ExpiresByType application/vnd.geo+json "access plus 0 seconds"

# HTML components (HTCs)
ExpiresByType text/x-component "access plus 1 year"

# Favicon
ExpiresByType image/x-icon "access plus 1 year"

# Imágenes, vídeo, audio: 1 año
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/jpeg "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"

# Fuentes web: 12 meses
ExpiresByType application/font-woff "access plus 1 year"
ExpiresByType application/font-woff2 "access plus 1 year"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresByType application/x-font-ttf "access plus 1 year"
ExpiresByType font/opentype "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
# CSS y JavaScript: 12 meses
ExpiresByType text/css "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType application/x-javascript "access plus 1 year"
ExpiresByType text/plain "access plus 1 year"
</IfModule>

# BEGIN HttpHeadersCompression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/ld+json
AddOutputFilterByType DEFLATE application/manifest+json
AddOutputFilterByType DEFLATE application/rdf+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/schema+json
AddOutputFilterByType DEFLATE application/vnd.geo+json
AddOutputFilterByType DEFLATE application/x-web-app-manifest+json
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/eot
AddOutputFilterByType DEFLATE image/bmp
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE image/vnd.microsoft.icon
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/x-component
AddOutputFilterByType DEFLATE text/xml
</IfModule>
# END HttpHeadersCompression
Categorías
Prestashop

¿Cómo eliminar los logs de prestashop?

En la base de datos ejecutar

// Para eliminar los logs
TRUNCATE TABLE ps_log;
// Para eliminar las estadisticas
TRUNCATE TABLE ps_statssearch;
Categorías
Programación

curl: (3) [globbing] illegal character in range specification at pos

El error se arregla escapando los símbolos, en la llamada curl

Ejemplo cambiar [ ] por \[\]

Otra opción seria poner la petición entre comillas dobles.

Categorías
Base de datos

Cambiar Server Collation Sql Server

Arrancar la consola cmd modo administrador

Ir a la siguiente ubicación con CD

C:\Program Files\Microsoft SQL Server\MSSQL14.NOMBRESERVIDOR\MSSQL\Binn

EJECUTAR el siguiente comando, cambiar el collation Latin1_General_CI_AI por el que se necesite.

NOTA: Antes de ejecutar el comando crear una copia de seguridad.

sqlservr -m -T4022 -T3659 -s"NOMBRESERVIDOR" -q"Latin1_General_CI_AI"
Categorías
Prestashop

¿Cómo detectar si es un móvil en Prestashop con .tpl?

Descubre cómo utilizar las clases de Prestashop para detectar el dispositivo utilizado y poder mostrar o no textos, imágenes, funciones adicionales de forma correcta y eficaz

Además de utilizar un tema responsive, que se adapta según el tamaño del dispositivo que utilice el usuario, puede ser útil para detectar si el dispositivo es un smartphone, una tablet o un ordenador.

En un tema receptivo, generalmente, usamos la técnica de no mostrar ciertas partes de la página en algunos dispositivos simplemente escondiéndolas a través de algunas reglas de hojas de estilo (css): esta solución no aligera el peso de las páginas porque el código oculto será de todos modos presente en la página y tan cargado por el navegador.

En cambio, mediante la detección del dispositivo utilizado, es posible que se muestren o no textos, imágenes, funciones adicionales, etc. de forma correcta y eficaz.

Prestashop 1.7.x y Prestashop 1.6.1.x

Estas versiones de Prestashop ya utilizan una clase para detectar el dispositivo utilizado (/classes/Context.php), gracias a la cual podemos consultar directamente en los archivos .tpl de nuestro tema.

Detectar un teléfono inteligente

{if Context::getContext()->isMobile() && !Context::getContext()->isTablet()}
  tu contenido
{/if}

o

{if Context::getContext()->getDevice() == 4}
  tu contenido
{/if}

Detectar una tableta

{if Context::getContext()->isTablet()}
  tu contenido
{/if}

o

{if Context::getContext()->getDevice() == 2}
  tu contenido
{/if}

Detectar una computadora

{if !Context::getContext()->isMobile() && !Context::getContext()->isTablet()}
  tu contenido
{/if}

o

{if Context::getContext()->getDevice() == 1}
  tu contenido
{/if}

Prestashop 1.6

Detectar un dispositivo móvil

{if isset($mobile_device) && $mobile_device}
  tu contenido
{/if}

Categorías
HTML5

FAVICONS: Cómo asegurarse de que los navegadores solo descarguen la versión SVG

<link rel="icon" href="/favicon.ico" sizes="any">
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
Categorías
CSS

Como convertir una img SVG a un color HEX con CSS

Nos vamos a esta web, he introducimos nuestro color HEX

Luego ponemos ese filtro generado en nuestro CSS, ejemplo

img{filter:invert(65%%) sepia(71%%) saturate(5198%%) hue-rotate(161deg) brightness(94%%) contrast(101%%);}
img:hover{filter:invert(65%%) sepia(80%%) saturate(586%%) hue-rotate(2deg) brightness(107%%) contrast(107%%)}

Recomendable que la imagen en svg, sea con fill negro o currentColor

Categorías
Prestashop

Como se quita del producto «Impuestos incluidos» de Prestashop

En el panel de Gestión de Prestashop en Internacional > Ubicaciones geográficas > Países > Busca el país, seleccionas modificar y luego desmarcas la opción «Mostrar la etiqueta de impuestos (por ejemplo, «Impuestos incl.»)«