.htaccess 不工作 apache-tomcat [英] .htaccess not working apache-tomcat

查看:46
本文介绍了.htaccess 不工作 apache-tomcat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个与 mod_jk 集成的 apache tomcat 服务器.我在要限制的目录中创建了 .htaccess 文件.但问题是 .htaccess 在 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 文档根目录为/var/ww/html我在它下面创建了一个测试目录并且它工作正常.

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

但是在/usr/local/src/apache-tomcat-6.0.35/webapps/examples我创建了一个 .htaccess 并且它不工作.

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

可能是什么原因?

推荐答案

.htaccess 是 Apache Web Server 文件,而不是 Tomcat.Tomcat 只是忽略这些文件.如果您通过 mod_jk 为您的应用程序提供服务,那么 JkMount 映射到的任何内容都由 Tomcat 提供服务,并且不会处理 .htaccess.如果您需要密码保护 Tomcat 目录,则需要在 Tomcat 中创建一个 Realm 并保护 Web 资源.一个旧的但我认为仍然准确的示例

.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

这篇关于.htaccess 不工作 apache-tomcat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆