---
url: 'https://metadrop.net/es/articulos/proteger-virtual-host-htpasswd-excluyendo-ips'
title: 'Proteger virtual host con .htpasswd excluyendo IPs'
author: 'Jorge Tutor'
date: '2017-01-17T10:18:47+00:00'
updated: '2026-02-18T09:52:03+00:00'
type: article
summary: 'Configuración y detalles sobre el fichero .htpasswd para proteger un virtual host.'
tags:
  - htaccess
  - IP
  - Htpasswd
  - Apache
published: true
og:
  determiner: Automatic
  site_name: Metadrop
  'image:alt': 'Proteger virtual host con .htpasswd excluyendo IPs'
  street_address: 'Calle Manuel Luna, 12, 3 Dcha'
  locality: Madrid
  region: Madrid
  postal_code: '28020'
  country_name: España
  email: hola@metadrop.net
  phone_number: '910053180'
schema:
  '@context': 'https://schema.org'
  '@graph':
    -
      '@type': Article
      '@id': 'https://metadrop.net/es/articulos/proteger-virtual-host-htpasswd-excluyendo-ips#article'
      name: 'Proteger virtual host con .htpasswd excluyendo IPs'
      headline: 'Proteger virtual host con .htpasswd excluyendo IPs'
      description: "Configuración y detalles sobre el fichero\_.htpasswd para proteger un\_virtual host."
      about:
        - htaccess
        - IP
        - Htpasswd
        - Apache
      datePublished: '2014-07-15T08:00:00+0200'
      dateModified: '2026-02-18T10:52:03+0100'
      author:
        '@type': Person
        name: 'Jorge Tutor'
      publisher:
        '@type': Organization
        '@id': 'https://metadrop.net/#organization'
      mainEntityOfPage: 'https://metadrop.net/es/articulos/proteger-virtual-host-htpasswd-excluyendo-ips'
    -
      '@type': Organization
      '@id': 'https://metadrop.net/#organization'
      url: 'https://metadrop.net/'
      name: Metadrop
      sameAs:
        - 'https://www.drupal.org/metadrop'
        - 'https://twitter.com/metadrop'
        - 'https://asociaciondrupal.es/partner/metadrop'
        - 'https://www.linkedin.com/company/metadrop'
      logo:
        '@type': ImageObject
        url: 'https://metadrop.net/themes/custom/mdrop_radix/logo-metadrop-500-500.jpg'
        width: '500'
        height: '500'
    -
      '@type': ItemPage
      '@id': 'https://metadrop.net/es/articulos/proteger-virtual-host-htpasswd-excluyendo-ips'
      breadcrumb:
        '@type': BreadcrumbList
        itemListElement:
          -
            '@type': ListItem
            position: 1
            name: Inicio
            item: 'https://metadrop.net/es'
          -
            '@type': ListItem
            position: 2
            name: 'Artículos expertos sobre Drupal y tecnología'
            item: 'https://metadrop.net/es/articulos'
      publisher:
        '@type': Organization
        '@id': 'https://metadrop.net/#organization'
---
 1. [Artículos](https://metadrop.net/es/articulos)
 
  

# Proteger virtual host con .htpasswd excluyendo IPs

Martes 15 de Julio de 2014

 

 



Configuración y detalles sobre el fichero .htpasswd para proteger un virtual host.



   



Siempre es más seguro proteger tus virtual host de apache con usuario y contraseña de cara al mundo exterior. Sin duda acaba siendo molesto para el equipo de desarrollo por lo que si dispones de ip fija puedes saltarte esta validación:

```plaintext
<Directory /home/proyecto/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksifOwnerMatch
# allow from all
AllowOverride All
...
AuthType Basic
AuthName 'Mensaje'
AuthUserFile '/pathtohtpasswd/.htpasswd'
Require user myusername
Order allow,deny
allow from XXX.XXX.XXX.XXX
allow from XXX.XXX.XXX.XXX
satisfy any
...
</Directory>
```

```plaintext
allow from XXX.XXX.XXX.XXX <- Sustituir por la IP correspondiente
```

Si usas alguna plantilla por defecto a la hora de dar de alta tus vhost recuerda comentar o eliminar "allow from all" ya que "satisfy any" toma cualquier condición como suficiente.

Utilidad: Generador de htpsswd online: [www.htaccesstools.com/htpasswd-generator/](https://www.htaccesstools.com/htpasswd-generator/)



[htaccess](https://metadrop.net/es/articulos?text=htaccess)

[IP](https://metadrop.net/es/articulos?text=IP)

[Htpasswd](https://metadrop.net/es/articulos?text=Htpasswd)

[Apache](https://metadrop.net/es/articulos?text=Apache)

 

- Jorge Tutor
    
    CIO