Drupal.htaccess

发布于 2024-09-28 09:43:15 字数 194 浏览 0 评论 0原文

我在我的网站中使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

已下线请稍等 2024-10-05 09:43:15

为了访问所有现有文件:

RewriteCond %{REQUEST_FILENAME} !-f

为了访问所有现有目录:

RewriteCond %{REQUEST_FILENAME} !-d

为了访问名为 handler.php 的特定文件: 为了

RewriteCond %{REQUEST_URI} !=/handler.php

访问名为 images 的特定目录:

RewriteCond %{REQUEST_URI} !=/images
RewriteCond %{REQUEST_URI} !=/images/(.*)

例如,

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/handler.php
RewriteCond %{REQUEST_URI} !=/images
RewriteCond %{REQUEST_URI} !=/images/(.*)
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

未经测试,但应该可以工作。让我知道您是否需要进一步的帮助。

In order to access all existing files:

RewriteCond %{REQUEST_FILENAME} !-f

In order to access all existing directories:

RewriteCond %{REQUEST_FILENAME} !-d

In order to access a specific file called handler.php:

RewriteCond %{REQUEST_URI} !=/handler.php

In order to access a specific directory called images:

RewriteCond %{REQUEST_URI} !=/images
RewriteCond %{REQUEST_URI} !=/images/(.*)

For instance,

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/handler.php
RewriteCond %{REQUEST_URI} !=/images
RewriteCond %{REQUEST_URI} !=/images/(.*)
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Not tested, but should work. Lemme know if you need further help.

小伙你站住 2024-10-05 09:43:15

在要中断的文件夹内创建一个 .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..

闻呓 2024-10-05 09:43:15

如果我理解正确,请使用以下代码:

RewriteCond %{REQUEST_URI} ^(/admin/|/user|/security) [NC] 
RewriteRule  .*  -  [F] 

where:

(/admin/|/user|/security) - 您要关闭的文件夹
如果您需要关闭一个 floder,请使用 (/admin) 所有路径 (/admin/)

[NC] - 不敏感的寄存器符号

RewriteRule .* - [F] - 返回 403 禁止状态

If I understand you correctly, use this code:

RewriteCond %{REQUEST_URI} ^(/admin/|/user|/security) [NC] 
RewriteRule  .*  -  [F] 

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文