Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.htaccess not working apache-tomcat

I have a apache tomcat server integrated with mod_jk. I have created .htaccess files in the directories I want to restrict. but the problem is .htaccess is working in apache served directories but not in the directories which is served by tomcat.

Apache document root is /var/ww/html I created a test directory under it and its working fine.

But in /usr/local/src/apache-tomcat-6.0.35/webapps/examples I created a .htaccess and its not working.

What could be the reason?

like image 371
Randeep Avatar asked May 10 '12 06:05

Randeep


People also ask

Why is my .htaccess file not working?

Improper syntax being used It is quite common for a syntax error to be the reason for an . htaccess file not working. If you are familiar with how to read and configure . htaccess rules, double check your configuration.

Where is .htaccess file in Apache Tomcat?

htaccess file can be found at installdir/APPNAME/. htaccess. Some applications do not have the installdir/apache2/conf/vhosts/htaccess/APPNAME-htaccess. conf file.


1 Answers

.htaccess are Apache Web Server files, not Tomcat. Tomcat just ignore these files. If you serve your application through mod_jk, then anything that JkMount maps to is served by Tomcat and no .htaccess will be processed. If you need to password protect Tomcat directories, you need to create a Realm in Tomcat and protect the web-resource. An old but I think still accurate example

like image 99
JScoobyCed Avatar answered Oct 25 '22 00:10

JScoobyCed