Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache Drupal的mod_重写和htaccess需要帮助_Apache_Drupal_.htaccess_Mod Rewrite_Drupal 6 - Fatal编程技术网

Apache Drupal的mod_重写和htaccess需要帮助

Apache Drupal的mod_重写和htaccess需要帮助,apache,drupal,.htaccess,mod-rewrite,drupal-6,Apache,Drupal,.htaccess,Mod Rewrite,Drupal 6,我想在我的服务器上启用.htaccess文件,以便在Drupal中使用“clean_url”功能 这就是我到目前为止所做的: sudo a2enmod rewrite sudo /etc/init.d/apache2 restart cd /etc/apache2/mods-enabled grep mod_rewrite * 在phpinfo()结果中,我可以看到:mod_rewrite,因此我猜模块已启用 我添加了一个htaccess文件,其中包含以下内容: <IfModule mo

我想在我的服务器上启用.htaccess文件,以便在Drupal中使用“clean_url”功能

这就是我到目前为止所做的:

sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart
cd /etc/apache2/mods-enabled
grep mod_rewrite *
在phpinfo()结果中,我可以看到:
mod_rewrite
,因此我猜模块已启用

我添加了一个htaccess文件,其中包含以下内容:

<IfModule mod_rewrite.c>
  RewriteEngine on

  RewriteBase /path/to/website

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

重新启动发动机
重写库/路径/到/网站
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_URI}=/图标文件
重写规则^(.*)$index.php?q=$1[L,QSA]

但它仍然告诉我我的服务器不提供这样的功能。我遗漏了什么?

确保检查服务器的配置或
VirtualHost
以确保设置为
All
。如果没有,您的.htaccess中的任何内容都不会被读取或执行。

您所说的“它仍然说我的服务器没有提供这样的功能”是什么意思?嗯,很抱歉,确实不清楚。Drupal会通知您是否可以打开“干净的url”,检查url重写是否启用。我的意思是它不起作用。嗯……其他人是。出于好奇,你运行的是同一个Drupal版本吗?是的,6.19,但我认为它不是Drupal。同一网站在另一台服务器上处理htaccess文件。我想我错过了一些服务器配置步骤。