At first before start proceedings we must know what is ht-access file and why we should use that one?
Basic Definition:
.htaccess files are configuration files of Apache Server which provide a way to make configuration changes on a per-directory basis. A file containing one or more configuration directives is placed in a particular document directory and the directives apply to that directory and all sub directories thereof.
per-directory basis: this means we have to put a ht-access file each directory of our web.
Example:
suppose we have 2 directories in our website like
http://oms-vision.blogspot.in/(Parent Directory )
http://oms-vision.blogspot.in/admin(Child Directory)
the first one contains the files for http://oms-vision.blogspot.in/ and the second on contains its admin account files.now if we put a htaccess file in parent directory by having some rules
RewriteEngine On
order allow,deny
allow from all
RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?action=$1 [NC]
RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?action=$1 [NC]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ index.php?action=$1&id=$2 [NC]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ index.php?action=$1&id=$2 [NC]
then the same rules will be applied to its child directories also.
now if u don't want to have any htaccess rules in child directory then u have to put another .htaccess file in child directory having rule
RewriteEngine Off
Basic Definition:
.htaccess files are configuration files of Apache Server which provide a way to make configuration changes on a per-directory basis. A file containing one or more configuration directives is placed in a particular document directory and the directives apply to that directory and all sub directories thereof.
per-directory basis: this means we have to put a ht-access file each directory of our web.
Example:
suppose we have 2 directories in our website like
http://oms-vision.blogspot.in/(Parent Directory )
http://oms-vision.blogspot.in/admin(Child Directory)
the first one contains the files for http://oms-vision.blogspot.in/ and the second on contains its admin account files.now if we put a htaccess file in parent directory by having some rules
RewriteEngine On
order allow,deny
allow from all
RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?action=$1 [NC]
RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?action=$1 [NC]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ index.php?action=$1&id=$2 [NC]
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ index.php?action=$1&id=$2 [NC]
then the same rules will be applied to its child directories also.
now if u don't want to have any htaccess rules in child directory then u have to put another .htaccess file in child directory having rule
RewriteEngine Off
No comments:
Post a Comment