简体   繁体   English

Drupal站点.htaccess阻止访问子域的index.html [500内部服务器错误]

[英]Drupal-site .htaccess blocks access to index.html for subdomain [500 Internal Server Error]

I've got a Drupal site running under the main domain. 我在主域下运行了一个Drupal站点。 With the following rewrite rules in the .htaccess file (rootlevel): 在.htaccess文件(根级别)中使用以下重写规则:

  # Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

This works fine for the Drupal installation which uses PHP, but it somehow interferes with a newly created subdomain that just uses plain HTML. 这对于使用PHP的Drupal安装效果很好,但是以某种方式干扰了仅使用纯HTML的新创建的子域。 Upon loading the sub-domain site the browser produces an error message: 加载子域站点后,浏览器会生成错误消息:

500 Internal Server Error 500内部服务器错误

In the logs I find the following error messages: 在日志中,我发现以下错误消息:

Request exceeded the limit of 10 internal redirects due to probable configuration error. 由于可能的配置错误,请求超出了10个内部重定向的限制。 Use 'LimitInternalRecursion' to increase the limit if necessary. 必要时使用'LimitInternalRecursion'增加限制。 Use 'LogLevel debug' to get a backtrace. 使用“ LogLevel调试”获取回溯。

How can I adjust the .htaccess file so that requests for the subdomain are not affected by the rewrite code that is needed for Drupal to function? 如何调整.htaccess文件,以使对子域的请求不受Drupal起作用所需的重写代码的影响? (While keeping that code functional for requests aimed at the site under the main domain, of course.) (当然,在使该代码对于针对主域下站点的请求起作用的同时)。

I stumbled across a solution provided by the Drupal community and decided to implement that one first. 我偶然发现了Drupal社区提供的解决方案,并决定首先实施该解决方案。 That works like a charm. 就像魅力一样。

Here's the link to the page in question: 这是相关页面的链接:

https://www.drupal.org/node/30334 https://www.drupal.org/node/30334

Look under the section called: 查看以下部分:

"Restore support for other Directory Index Files (index.htm)". “恢复对其他目录索引文件(index.htm)的支持”。

It reads: 内容为:

"Drupals .htaccess file also includes a line (DirectoryIndex) that gives instructions "If asked for a directory path, return the index.php file found in that directory". This replaces the normal webserver behaviour that usually says "return the index.htm file found there"..." “ Drupals .htaccess文件还包括一行(DirectoryIndex),该行给出了说明:“如果要求目录路径,请返回在该目录中找到的index.php文件。”这取代了通常显示为“ return the index.htm”的正常Web服务器行为。在此处找到文件“ ...”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM