【问题标题】:How to exclude a folder on Drupal site so that Drupal does not recognise it its own?如何排除 Drupal 站点上的文件夹,使 Drupal 无法识别它自己的文件夹?
【发布时间】:2010-04-27 02:49:54
【问题描述】:

我正在 Drupal 中运行一个站点 xyz.org

现在我想安装一些其他模块,例如 PHPBB 论坛和 Coppermine 画廊。当我安装这些并尝试访问链接 xyz.org/gallery 时,它给了我 drupal 错误。

“找不到页面”

我需要更改哪些设置才能让 drupal 知道 /gallery 不是 drupal 节点?

【问题讨论】:

  • Ruchir,您应该用打勾将答案标记为已接受,以表明它有帮助。

标签: drupal .htaccess drupal-6


【解决方案1】:

查看您当前的 .htaccess 配置。如果可能有以下几行:

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

那些包含大部分重要的 URL 重写。前三个条件表示所有 URL 都将被重写,除了现有文件、目录和对 /favicon.ico 的请求 您可以在那里添加自己喜欢的条件。例如,为了避免重写 /gallery/.* 形式的 url:

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

【讨论】:

  • 谢谢,这个简单的一个班轮为我节省了很多痛苦!
  • 对于drupal 7,尝试:RewriteCond %{THE_REQUEST} !/directory_name/.*
  • 有关如何在 Drupal 7 上执行此操作的更多详细信息,请参阅:drupal.org/node/47092#comment-7309216