Drupal.htaccess
我在我的网站中使用 Drupal,但在 drupal 之外有一些文件夹。我想从重写规则中排除这些文件夹。
我已经尝试过:
- RewriteCond %{REQUEST_URI} !^/admin/ in .htaccess
- Options +MultiViews in apache config
I am using Drupal in my website but there are some folders outside drupal. I want to exclude those folders from rewrite rules.
I already tried :
- RewriteCond %{REQUEST_URI} !^/admin/ in .htaccess
- Options +MultiViews in apache config
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为了访问所有现有文件:
为了访问所有现有目录:
为了访问名为 handler.php 的特定文件: 为了
访问名为 images 的特定目录:
例如,
未经测试,但应该可以工作。让我知道您是否需要进一步的帮助。
In order to access all existing files:
In order to access all existing directories:
In order to access a specific file called handler.php:
In order to access a specific directory called images:
For instance,
Not tested, but should work. Lemme know if you need further help.
在要中断的文件夹内创建一个 .htaccess。 Apache 将读取根 .htaccess 文件,然后读取文件夹 .htaccess 文件。因此,无论您在文件夹中的 .htaccess 文件中放置什么内容,都将拥有最后的决定权。
DirectoryIndex index.html
恢复index.html
ErrorDocument 404默认
恢复正常的404错误
大多数情况下,您可以忽略Drupal位于父目录中。
http: //wsmithdesign.wordpress.com/2010/09/06/adding-drupal-to-an-existing-site-allowing-for-existing-content/
要完全取消继承父 .htaccess,您必须重写所有具有新价值的指令。如果您不需要使用它,也可以尝试在子目录.htaccess中关闭RewriteEngine。
Create a .htaccess inside the folder that you want to break off. Apache will read the root .htaccess file then the folder .htaccess file. So what ever you place in the .htaccess file in the folder will have the last say.
DirectoryIndex index.html
to restore index.html
ErrorDocument 404 default
Restore normal 404 errors
For the most part you can ignore Drupal is in the parent directory.
http://wsmithdesign.wordpress.com/2010/09/06/adding-drupal-to-an-existing-site-allowing-for-existing-content/
To completely disinherit the parent .htaccess you must rewrite all the directives with new values. You can also try RewriteEngine Off in the subdirectory .htaccess if you do not need to use it..
如果我理解正确,请使用以下代码:
where:
(/admin/|/user|/security) - 您要关闭的文件夹
如果您需要关闭一个 floder,请使用 (/admin) 所有路径 (/admin/)
[NC] - 不敏感的寄存器符号
RewriteRule .* - [F] - 返回 403 禁止状态
If I understand you correctly, use this code:
where:
(/admin/|/user|/security) - folder that you want to close
if you need close one floder use (/admin) all paths (/admin/)
[NC] - insensitive register symbols
RewriteRule .* - [F] - return a 403 Forbidden status