apacheurl重写根目录上的连接重置


apache url rewrite connection reset on root directory

在我的apache sites-available/default文件中,我将配置更改为:

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All             //originally was AllowOverride None
    FallbackResource rewrite.php  //i added this line, too
    Order allow,deny
    allow from all
</Directory>

我想在我自己的rewrite.php文件中处理所有url调用。当我访问我在http://192.168.1.104:4567/web/knxzkcha的网站时,这是有效的,但当我访问http://192.168.1.104:4567/web/时,这不起作用。我在firefox中遇到了这个问题:The connection to the server was reset while the page was loading.

索引站点http://192.168.1.104:4567/web/index.php完美地工作,并向我展示了我的index.php文件。我只想让我在访问根目录时也显示索引文件。/var/www指向/web目录。我有一些ubuntu 12.04服务器64 LTS版

当我重新插入配置行时,根默认情况下会给我索引文件。

您不需要添加AllowOverride All,告诉apache通过使用AllowOverride None检查当前目录和所有父目录中是否存在.htaccess文件来避免IO是一个很好的速度秘诀。如果可以编辑Apache配置,请避免使用.htaccess文件。

现在FallbackResource是一个非常新的功能,可能有一些错误。您查看错误日志了解详细信息了吗?你能用LogLevel debug试试吗?

你的问题似乎是目录,也许你可以通过在请求目录时强制使用回退来解决它,试着添加:

DirectoryIndex  rewrite.php