Question:- How to enable .htaccess for Apache web server? How to enable .htaccess for Apache virtual hosts? How to enable .htaccess uses in the httpd server?
Advertisement
The .htaccess enables the directory level configuration for the Apache server. This allows users to override the Apache global and virtual host settings.
Enable .htaccess in Apache
Edit Apache virtual host configuration file in your favorite editor and add the following Directory tag.
Update /var/www/html
with your application document root.
1 2 3 4 5 6 7 8 9 10 11 12 13 | <VirtualHost *:80> ServerName example.com # Disable .htaccess for /var/www directory for security <Directory "/var/www"> Allowoverride none </Directory> # Enable .htaccess for /var/www/html directory and its subdirectories <Directory "/var/www/html"> Allowoverride all </Directory> </VirtualHost> |
The first directory tag will disable using of .htaccess in /var/www directory. The second directory tag will enable the use of .htaccess under /var/www/html directory.
2 Comments
Hi,
basically i am new in this field .what my requirement is when i type my domain in URL it shows a page but what i need is when i type a URL it should automatically direct URL/query-string
at present i have to type Manuel y query-string along with URL
IE
domain name.com, if i type domain name.com it should automatically direct to domain name.com/academy.
how can i write the htaccess fole for the same centos7 httpd
Hi,
basically i am new in this field .what my requirement is when i type my domain in URL it shows a page but what i need is when i type a URL it should automatically direct URL/query-string
at present i have to type Manuel y query-string along with URL
IE
ias.enfinlabs.com it i type ias.enfinlabs.com it should automatically direct to ias.enfinlabs.com /academy.