阿帕奇:.htaccess文件是从顶部驱动目录下读取 [英] Apache: .htaccess file is read from the top drive directory

查看:142
本文介绍了阿帕奇:.htaccess文件是从顶部驱动目录下读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的DocumentRoot是 E:/ WWW - 我下面的的httpd.conf 文件的一部分:

My DocumentRoot is e:/www - below my httpd.conf file part:

DocumentRoot "e:/www"
<Directory "e:/www">
    Options FollowSymLinks
    Options +Indexes
    AllowOverride All
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
    Allow from ::1
    Allow from localhost
</Directory>

和我有2 的.htaccess 文件phisically位于:

and I have 2 .htaccess files phisically located here:

  1. E:/www/.htaccess
  2. E:/ htaccess的

有一个在的httpd.conf 文件创建任何额外的别名。

There is no additional Alias created in httpd.conf file.

E:/ htaccess的读取其内容会影响服务器的性能比较

e:/.htaccess is read and its contents affect server perfomance.

为什么阅读的内容,在所有?

Why are the contents read at all??

推荐答案

一个几件事情要注意。你不应该使用的.htaccess如果你有机会到主配置文件如: 的httpd.conf 。它会减慢你的Web服务器因为Apache已扫描的htaccess文件的目录和应用规则。它是preferred方法,把它的配置在目录指令。所有的配置被修改时,阿帕奇必须重新装载/也重新启动。

A couple of things to note. You should not use .htaccess if you have access to the main config file e.g. httpd.conf. It slows down your web server because Apache has to scan the directories for htaccess files and apply the rules. It is the preferred method to put it in the config in the Directory directive. Any time the config is modified, Apache must be reloaded/restarted also.

,是因为它能够扫描所有目录,将看到.htaccess文件的级别了上面而你的情况是 E:\ htaccess的

So because it has to scan all directories it will see the .htaccess file at the level up above which in your case is e:\.htaccess.

如果您向Ë一个文件,这样:\ WWW \例子。它会寻找.htaccess文件在这些目录

So if you request a file from e:\www\example. It will look for the .htaccess files in these directories

e:\.htaccess
e:\www\.htaccess
e:\www\example\.htaccess

这就是为什么htaccess是不利于性能。它主要用于共享主机或时间时,你不必直接访问的httpd.conf 文件。

That's why htaccess is not good for performance. It's mostly used for shared hosting or for times when you don't have direct access to the httpd.conf file.

阅读本节的 当不使用.htaccess文件 从Apache基金会。 这将消除这方面有任何问题。

Read this section on When not to use .htaccess files from the Apache foundation. It will clear up any questions about this.

这篇关于阿帕奇:.htaccess文件是从顶部驱动目录下读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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