RewriteEngine On时出错 - 表示FollowSymLinks已关闭

时间:2014-07-25 17:02:20

标签: apache .htaccess mod-rewrite

我到处搜索(包括这里),但无法找到合适的答案!

我已经接管了新设置的Web服务器的控制权,但可能没有理想的设置(但是)但是我无法在.htaccess文件中使用RewriteEngine On。错误日志表明它无法完成,因为FollowSymLinks已关闭。

除了我无法看到它关闭的地方!

这是使用Apache 5.4.30

的CentOS 6.5版(最终版)

网络文件存储在/ home / domain-name / public_html和 httpd.conf有(除其他外)

<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

DocumentRoot "/var/www/html"

<Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

<Directory /home/*/public_html>
    Options +ExecCGI +FollowSymLinks +Includes -Indexes +MultiViews
    XBitHack On
    AllowOverride All
    DirectoryIndex index.html index.html.var index.htm index.shtml index.php default.html default.htm default.shtml
</Directory>

<VirtualHost *:80>
        DocumentRoot /var/www/html
        ServerName server52218.uk2net.com
        <Directory /var/www/html>
            Options ExecCGI FollowSymLinks Includes IncludesNOEXEC Indexes MultiViews
            XBitHack On
            AllowOverride All
            DirectoryIndex index.html index.html.var index.htm index.shtml index.php default.html default.htm default.shtml
        </Directory>
</VirtualHost>

<Directory "/var/www/sites">
    Options ExecCGI FollowSymLinks Includes -Indexes MultiViews
    XBitHack On
    AllowOverride All
    DirectoryIndex index.html index.html.var index.htm index.shtml index.php default.html default.htm default.shtml
    Order allow,deny
    Allow from all
</Directory>

单个站点配置文件没什么大不了的;指定DocumentRoot,ScriptAlias,ServerName / Alias和Logs。

如果网站需要使用重写,则.htaccess文件具有RewriteEngine On,这会导致错误发生并显示在错误日志中。删除该行,网站显示确定(当然,重写现在不起作用!)

这与旧服务器上的设置完全相同(据我所知)但是运行的是带有Apache 2.2.3的CentOS 5.10

我已尝试在htaccess文件中指定Options指令但仍然没有喜悦。

我错过了什么?我在哪里看下一个?

通常/home/domain-name/public_html/.htaccess包含

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

1 个答案:

答案 0 :(得分:0)

看起来这完全归功于/etc/httpd/conf.d/welcome.conf中的声明,其中说

<LocationMatch "^/+$">
    Options Indexes
    ErrorDocument 403 /error/noindex.html
</LocationMatch>

将选项语句更改为

Options -Indexes

似乎让事情再次发挥作用。不过,我不确定为什么。