cuaderno de campo

anotaciones

Menú
  • casa
    • dinou del carrer nou
  • cocina
    • pan
    • repostería
    • verdura
  • huerto
    • plano del número 29
    • huerto del año 2023
  • humanidades
    • fonoteca
    • galería
  • juego
    • lista de juegos
    • recalbox en rpi 3
    • dosbox
  • linux
    • bash
    • sistema operativo
    • ssh
  • web
    • apache
    • css
    • html5
    • javascript
    • mysql
    • php
Menú

prevención del hotlinking de imágenes

Publicado el 1 de diciembre de 201726 de febrero de 2021 por ernesto
<IfModule mod_rewrite.c>
     RewriteEngine on
     RewriteCond %{HTTP_REFERER} !^$
     RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?poderna.com/.*$ [NC]
     RewriteRule .(jpg|png)$ http://poderna.com/archivo/imagen/editor.png [NC,R,L]
</IfModule>

tras poner en marcha el motor de rescritura con rewriteengine (mod_rewrite), se establecen dos condiciones mediante rewritecond:  si no hay http referer (!^$) o si éste no se corresponde con el dominio poderna.com, se aplica la siguiente regla de rescritura (rewriterule): al patrón «.(jpg|png)$» (esto es, a la solicitud de un archivo cuya extensión sea jpg o png) se lo sustituye por http://poderna.com/archivo/imagen/editor.png con las siguientes banderas como condición:

NC
Use of the [NC] flag causes the RewriteRule to be matched in a case-insensitive manner.

R
Use of the [R] flag causes a HTTP redirect to be issued to the browser […] Any valid HTTP response status code may be specified, using the syntax [R=305], with a 302 status code being used by default if none is specified.

L
The [L] flag causes mod_rewrite to stop processing the rule set.

también es posible devolver un error en lugar de otra imagen:

RewriteRule .(jpg|png)$ – [F,L]

donde

F
Using the [F] flag causes the server to return a 403 Forbidden status code to the client.

fuente: dreamhost.com.

Etiquetado como rewritecond, rewriteengine, rewriterule
  • desactivación de las etags

    FileETag None <IfModule mod_headers.c> Header unset ETag </IfModule> esta es la manera de excluir el…

  • acceso a los directorios

    Options All -Indexes la directiva options «configures what features are available in a particular directory».…

  • cabeceras de codificación e idioma

    AddDefaultCharset UTF-8 DefaultLanguage es la directiva adddefaultcharset (core) permite los «media type's charset parameters» definidos…

RSS rutas fuera

  • Review – Tonight it’s a World We Bury 29 de mayo de 2023 Hate Meditations
  • Necropolis #67 – Damim 29 de mayo de 2023 Hate Meditations
  • Sadistic Metal Reviews: Covert Dualism Propaganda Edition 28 de mayo de 2023 Brett Stevens
  • Beats and yelling from: Kostnatění, Sporae Autem Yuggoth, KRE^U 26 de mayo de 2023 Hate Meditations
  • Conjureth – The Parasitic Chambers (2023) 24 de mayo de 2023 Belisario
  • Hessian Scrum: Justin Vølus (Vargheist records, Vølus, Psionic Madness etc) 23 de mayo de 2023 hessianfirm
  • Beats and yelling from: Hail Conjurer, Hasard, Martre 21 de mayo de 2023 Hate Meditations
  • Cadaver Releases Modern Metal Hit “The Age of the Offended” 19 de mayo de 2023 Brett Stevens
  • Review – Black Metal Rainbows 18 de mayo de 2023 Hate Meditations

Categorías

apache bash casa cocina corral css exterior fonoteca galería html5 huerto humanidades humanidades digitales interior jardín javascript juego linux mysql pan php repostería sistema operativo ssh verdura web

Archivo

cuaderno de campo 2011-2023