github.com/krum110487/go-htaccess@v0.0.0-20240316004156-60641c8e7598/tests/data/htaccessFiles/.htaccess5 (about)

     1  #
     2  # Require (user|group|valid-user) (username|groupname)
     3  #
     4  ## BASIC PASSWORD PROTECTION
     5  AuthType basic
     6  AuthName "prompt"
     7  AuthUserFile /.htpasswd
     8  AuthGroupFile /dev/null
     9  Require valid-user
    10  
    11  ## ALLOW FROM IP OR VALID PASSWORD
    12  Require valid-user
    13  Allow from 192.168.1.23
    14  Satisfy Any
    15  
    16  ## PROTECT FILES
    17  <FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$">
    18  Order Allow,Deny
    19  Deny from all
    20  </FilesMatch>
    21  
    22  ## PREVENT HOTLINKING
    23  SetEnvIfNoCase Referer "^https://www.askapache.com/" good
    24  SetEnvIfNoCase Referer "^$" good
    25  <FilesMatch "\.(png|jpg|jpeg|gif|bmp|swf|flv)$">
    26  Order Deny,Allow
    27  Deny from all
    28  Allow from env=good
    29  ErrorDocument 403 https://www.google.com/intl/en_ALL/images/logo.gif
    30  ErrorDocument 403 /images/you_bad_hotlinker.gif
    31  </FilesMatch>
    32  
    33  ## LIMIT UPLOAD FILE SIZE TO PROTECT AGAINST DOS ATTACK
    34  #bytes, 0-2147483647(2GB)
    35  LimitRequestBody 10240000
    36  
    37  ## MOST SECURE WAY TO REQUIRE SSL
    38  # https://www.askapache.com/htaccess/apache-ssl-in-htaccess-examples/
    39  SSLOptions +StrictRequire
    40  SSLRequireSSL
    41  SSLRequire %{HTTP_HOST} eq "askapache.com"
    42  ErrorDocument 403 https://askapache.com
    43  
    44  ## COMBINED DEVELOPER HTACCESS CODE-USE THIS
    45  <FilesMatch "\.(flv|gif|jpg|jpeg|png|ico|js|css|pdf|swf|html|htm|txt)$">
    46  Header set Cache-Control "max-age=5"
    47  </FilesMatch>
    48  AuthType basic
    49  AuthName "Ooops! Temporarily Under Construction..."
    50  AuthUserFile /.htpasswd
    51  AuthGroupFile /dev/null
    52  Require valid-user      # password prompt for everyone else
    53  Order Deny,Allow
    54  Deny from all
    55  Allow from 192.168.64.5   # Your, the developers IP address
    56  Allow from w3.org      # css/xhtml check jigsaw.w3.org/css-validator/
    57  Allow from googlebot.com   # Allows google to crawl your pages
    58  Satisfy Any        # no password required if host/ip is Allowed
    59  
    60  ## DONT HAVE TO EMPTY CACHE OR RELOAD TO SEE CHANGES
    61  ExpiresDefault A5 #If using mod_expires
    62  <FilesMatch "\.(flv|gif|jpg|jpeg|png|ico|js|css|pdf|swf|html|htm|txt)$">
    63  Header set Cache-Control "max-age=5"
    64  </FilesMatch>
    65  
    66  ## ALLOW ACCESS WITH PASSWORD OR NO PASSWORD FOR SPECIFIC IP/HOSTS
    67  AuthType basic
    68  AuthName "Ooops! Temporarily Under Construction..."
    69  AuthUserFile /.htpasswd
    70  AuthGroupFile /dev/null
    71  Require valid-user      # password prompt for everyone else
    72  Order Deny,Allow
    73  Deny from all
    74  Allow from 192.168.64.5   # Your, the developers IP address
    75  Allow from w3.org      # css/xhtml check jigsaw.w3.org/css-validator/
    76  Allow from googlebot.com   # Allows google to crawl your pages
    77  Satisfy Any        # no password required if host/ip is Allowed