Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.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忽略我的.htaccess文件_Apache_.htaccess - Fatal编程技术网

Apache忽略我的.htaccess文件

Apache忽略我的.htaccess文件,apache,.htaccess,Apache,.htaccess,Apache完全忽略了我的.htaccess文件,无论我在其中写入什么,它都不会读取它 “重写模式”已启用 AllowOverride设置为所有 虚拟主机:/etc/apache2/sites enabled/example.com <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName example.com ServerAlias *.example.com DocumentR

Apache完全忽略了我的.htaccess文件,无论我在其中写入什么,它都不会读取它

  • “重写模式”已启用
  • AllowOverride设置为所有
虚拟主机:/etc/apache2/sites enabled/example.com

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName example.com
    ServerAlias *.example.com
    DocumentRoot /var/www/example.com

    <Directory /var/www/example.com>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

</VirtualHost>
所有与此相关的问题似乎总是通过启用mod rewrite或将AllowOverride更改为All而不是None来解决。但这对我来说毫无用处,是的,我已经重新加载并重新启动了apache。(Ubuntu 12.10“Quantal Quetzal”最小x64,Apache/2.2.22)

我该如何着手解决这个问题

编辑: 我从未真正发现这背后的问题,但一次干净的重新安装(再次)解决了问题。

尝试

RewriteEngine on
RewriteRule ^hjalp/$ index.php?page=help

如果没有斜杠,它对我有用

到目前为止,您的配置和htaccess看起来还不错。到底发生了什么?如果您有权访问日志文件,请查看
/var/log/apache2/
目录,查看请求的内容(
access
文件)以及可能发生的错误(
error
文件)。日志行中有一个时间戳,您可以在其中将访问/错误消息与最新的请求关联起来。当我尝试访问/hjalp/时,我只得到一个404。apache错误日志也不是很有用,它们只是说“文件不存在:/var/www/example.com/hjalp”您确定启用了mod_rewrite吗
ls/etc/apache2/mods已启用/| grep rewrite
rewrite.load。。。是的,mod_rewrite也是根据phpinfo()加载的。一定有什么我错过了,这是一个干净的安装使用默认配置文件…你有启用mod_别名和mod_userdir?我的重写规则是在开发环境中工作的,我相信这个问题与Apache有关。您尝试过不使用斜杠吗?
RewriteEngine on
RewriteRule ^hjalp/$ index.php?page=help