Wednesday, March 27, 2013

any type of file restriction from server


RewriteEngine on
rewritecond %{http_host} ^www.domain.in [nc]
rewriterule ^(.*)$ http://domain.in/$1 [r=301,nc]


# Disable directory listing from this point
Options -Indexes

# Prevent viewing of htaccess file
<Files ~ "^\">
order allow,deny
deny from all
satisfy all
</Files>

# Force all PDF files to download
# Requires Apache Header Module - this will work for any file extensions
# below code it will automaticaly  download
<FilesMatch "\.(http://www.karyd.in?i:pdf)$">
  ForceType application/octet-stream
  Header set Content-Disposition attachment
</FilesMatch>

<FilesMatch \.(?i:gif|jpe?g|png|css|js)$>
    Order Deny,Allow
    Deny from all
</FilesMatch>

<FilesMatch /folder2/folder22/.*>
    Order Deny,Allow
     Deny from all
</FilesMatch>

<FilesMatch (robots\.txt)$>
    Order Deny,Allow
    Allow from all
</FilesMatch>

AuthType Basic
AuthName "Personal use"
AuthUserFile /full/path/to/.htpasswd
Require valid-user

No comments:

Post a Comment