2

本地主机设置

Ubuntu 12.04

mod重写启用

在不同目录中运行的多个站点

目录结构

/var/www/mysite1/htdocs/
/var/www/filehostwatch.com/htdocs/
.
.
.

wordpress .htaccess 在我的getsimple dir中工作(出于测试原因复制)没有问题

getsimple 的那个给了我一个 500 服务器遇到内部错误或配置错误...我后来发现这部分是导致错误的原因

.htacess

AddDefaultCharset UTF-8

现在导致错误的部分

Options -Indexes

# blocks direct access to the XML files - they hold all the data!
<Files ~ "\.xml$">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>
<Files sitemap.xml>
        Order allow,deny
    Allow from all
    Satisfy All
</Files>

导致 500 错误的部分的结尾

RewriteEngine on

# Usually it RewriteBase is just '/', but 
# replace it with your subdirectory path
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]

该站点的 /etc/apache2/sites-enabled/ 中的配置文件看起来像另一个站点的配置文件,其中 wordpress 运行没有问题。正如我所说,来自 wordpress 的 htaccess 在复制时甚至可以在这个站点中工作。

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName filehostwatch.localhost

    DocumentRoot /var/www/filehostwatch.com/htdocs
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/filehostwatch.com/htdocs/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride FileInfo
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

知道什么可能导致这个问题吗?

4

2 回答 2

1

您可能应该在有问题的部分更改Satisfy AllSatisfy Any,看看它是否有帮助。

AddDefaultCharset UTF-8

Options All -Indexes

# blocks direct access to the XML files - they hold all the data!
<Files ~ "\.xml$">
    Order deny,allow
    Deny from all
</Files>
<Files sitemap.xml>
    Satisfy Any
    Order allow,deny
    Allow from all
</Files>

RewriteEngine On

# Usually it RewriteBase is just '/', but 
# replace it with your subdirectory path
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]
于 2013-01-03T06:34:21.217 回答
0

如果我正确理解您的问题....htaccess在您的/var/www/filehostwatch.com/htdocs/目录中吗?在这种情况下,我认为您没有为您的.htaccess文件提供足够的权限来配置您想要的内容......在您的虚拟主机设置中,您拥有:

<Directory /var/www/filehostwatch.com/htdocs/>
    ...
    AllowOverride FileInfo
    ...
</Directory>

这提供了更改 mod_rewrite 设置的能力,但不允许更改主机访问(例如Allow& Deny)或更改Options.

您是否尝试AllowOverride All在您的虚拟主机配置中将其设置为?或者,您可以将更多指令设置添加到 AllowOverride 选项。副手我认为AllowOverride FileInfo Limit Options应该做的伎俩。

另请参阅Apache 关于 AllowOverride 的文档

于 2013-01-04T00:24:29.517 回答