Archive for htaccess

What is AllowOverride directive and what is the use of it

What is the use : Types of directives that are allowed in .htaccess files

This directive decalres which directives in distributed .htaccess files can override directives from the parent levels (httpd.conf). There are three values can be provided for this directive, those are All, None and FileInfo.

All and FileInfo enables .htaccess file and all ISAPI_Rewrite directives in it.

When this directive is set to None and AllowOverrideList is set to None .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccess files in the filesystem.This means if you specify AllowOverride none for some directory or virtual host .htaccess files will also be disabled for all subdirectories.

When this directive is set to All, then any directive which has the .htaccess Context is allowed in .htaccess files.

viagra

Block specific file extensions using .htaccess

Some times you need to block visitor access to specific file types that is not being used in web server.You can make that possible by using .htaccess.Look at the example given below. First of all open .htaccess file in public_html folder(if it is not there just create one). Add the below lines to it.

<Files ~ "\.jpg$">
Order allow,deny
Deny from all
</Files>

The above .htaccess will block the files with extension .jpg . If you want to block multiple file extensions seperate them as follows.

<Files ~ "\.(jpg|inc|3gp|sh)$">
Order allow,deny
Deny from all
</Files>