我的电脑上安装了 WAMP,我想在其中运行 Drupal 6。
当我安装 Drupal 时,我可以选择激活 Clean URL。
首先,我将 Drupal 安装放在 www 文件夹中,我可以选择启用干净的 URL,但出于备份原因,我将其移到 www 文件夹之外,并创建了一个指向该文件夹的别名。
当我再次安装 Drupal 时,我无法再选择启用干净的 URL;该选项呈灰色。
我想知道为什么会发生这种情况;似乎某些 Apache 模块或 PHP 扩展在 www 文件夹之外不可用。
可以肯定的是,我还尝试了 XAMPP 安装,并使用 WAMP 服务器中的一些代码行创建了一个别名,但由于某种原因,它有效。 WAMP 中的 Apache 版本与 XAMPP 安装不同,但我认为这并不相关。
我相信这是 WAMP 中的配置错误,但我无法找出原因。
最佳答案
干净的 URL 在您复制的 Drupal 目录中不起作用,因为对于该目录,指令 AllowOverride
未设置为 All
。
Drupal 要求启用 .htaccess 文件中的每个指令,以便启用干净的 URL;指令AllowOverride ,当设置为 All
时,允许使用 .htaccess 可以包含的所有指令。
在一种情况下您可以选择启用干净 URL 的选项,而在另一种情况下则不可选择,因为 Drupal 在安装过程中会验证服务器是否设置为使用干净 URL,并更改如果服务器不支持此功能,则表单字段为只读。
请注意,Drupal 提供的 .htaccess 文件可能需要进行编辑,以便启用干净的 URL,如以下注释中所述,可在 .htaccess 文件中找到。
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
# RewriteBase /
关于drupal - WAMP + 目录别名 + Drupal 干净 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5686997/