Htaccess files are files containing single or several configuration apache directives, which should be placed inside the web directory where changes have to made and all its sub directories.
The easient way to enable .htaccess file in apache is tp add the following in the Apache / HTTPD conf, Uncomment the below line and restart apache. You need to enable rewrite module
#LoadModule rewrite_module modules/mod_rewrite.so to
LoadModule rewrite_module modules/mod_rewrite.so
Add this to the Apache Main Configuration.
AccessFileName .htaccess
.htaccess file can have different name just specify the name following
AccessFileName your_htaccess_file_name
Pros
Useful when Administrators, Developers, requires to make configuration changes on per directory basis
Useful for ISP and Webhosting providers to permit multiple users running multiple sites on the same server to change thier own htaccess file.
Cons
Never use .htaccess files if you dont have the access to the Server Configuration File.
Uses Need to have root or Super User access to edit the main configuration file in apache.
Never Use user authetication in htaccess file instead do it in the Apache Main Configuration.
AllowOverride when set to allow apache will search for .htaccess file in every directory which would lead in poor performance of the webserver.
Directives in a .htaccess file
SSI (Server Side includes .htaccess file) Samples
Options +Includes
AddType text/html shtml
AddHandler server-parsed shtml
CGI Samples
Options +ExecCGI
AddHandler cgi-script cgi pl
Live Examples :
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
Satisfy all
No comments:
Post a Comment