包括来自的.htaccess另一个htaccess文件 [英] Include another htaccess file from .htaccess

查看:239
本文介绍了包括来自的.htaccess另一个htaccess文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能做的包括在.htaccess从另一个htaccess文件的规则?

Is it possible to do include rules from another htaccess file in .htaccess ?

.htaccess

RewriteEngine On
RewriteCond ...
RewriteRule ...

Include .htaccess1
.
.
Include .htaccess2

做这给出了一个500包括此处不允许 有没有办法做到这一点?因为我需要这个pretty的厉害。

Doing this gives a 500. Include not allowed here Is there a way to do this ? Because I need this pretty badly.

推荐答案

您不能包括规则,报表,定义,或从其他文件指令从一个htaccess文件。该包含指令不能在内部使用htaccess文件。一个htaccess文件的问题的一部分是类似行动,以一个<目录> 块,但可以自给自足的,无法目录本身的外部访问的东西(子目录都OK ),但更具体什么文档根目录之外。这样一来,有人做恶意的事情就不能来点请求或包括来自其他目录中的文件/内容被黑客htaccess的文件。

You can't include rules, statements, definitions, or directives from other files from an htaccess file. The Include directive can't be used inside an htaccess file. Part of the point of an htaccess file is to act similarly to a <Directory> block but be self contained and unable to access things outside of the directory itself (subdirectories are ok) but more specifically nothing outside of the document root. This way, someone doing malicious things won't be able to point requests or include files/content from other directories by hacking the htaccess file.

在mod_rewrite的范围明确,有对 RewriteOptions 允许的从父目录 htaccess的文件继承重写规则,但没有随意包括从任何地方的规则。

In the scope of mod_rewrite specifically, there are options for the RewriteOptions that allow inheriting rewrite rules from the htaccess file from a parent directory, but nothing to arbitrarily include rules from anywhere.

这篇关于包括来自的.htaccess另一个htaccess文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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