0

我有一个 VirtualHost 指令/etc/apache2/openpanel.d/www.example.com.conf

<VirtualHost *:80>
   ServerAdmin        "jon@example.com"
   DocumentRoot       /home/openpanel-admin/sites/www.example.com/public_html
   ServerName         www.example.com
   ServerAlias        example.com
   <Directory /home/openpanel-admin/sites/www.example.com/public_html>
   AllowOverride      All
   Allow from all
   </Directory>
   Include /etc/apache2/openpanel.d//www.example.com.inc/[^.#]*
   Include /etc/apache2/openpanel.d//global.inc
</VirtualHost>

我有以下内容/etc/apache2/openpanel.d/www.example.com.inc/RewriteRules

<Directory /home/openpanel-admin/sites/www.stallfinder.com/public_html>
        Options +FollowSymlinks
        RewriteEngine On

        RewriteRule agricultural-show-c780.html /search/event/agricultural-shows/1/ [R=301,L]
        RewriteRule antique-fair-c596.html /search/event/antique-and-collectors-fairs/1/ [R=301,L]
        RewriteRule baby-and-toddler-fairs-c896.html /search/event/baby-and-toddler-fairs/1/ [R=301,L]
        RewriteRule book-fair-c631.html /search/event/book-fairs/1/ [R=301,L]

        # etc... there are ~3000 of these
</Directory>

我有一个.htaccess文件/home/openpanel-admin/sites/www.example.com/public_html

Options +FollowSymlinks

RewriteEngine On
RewriteBase /

# Search pages
RewriteRule ^search/(stallholder|event)/?$ /find-$1.php [L]
RewriteRule ^search/(stallholder|event)/([^/]+)/([0-9]+)/? /$1.php?name=$2&id=$3 [L]

但是包含文件 (RewriteRules) 中的 RewriteRules 似乎没有被解析/使用。

该文件被包含在内,因为我可以在其中放置不允许的内容,并且 apache 将无法加载配置文件,但是如果我打开 Apache 重定向日志记录,那么我只会看到 [perdir] 行,就好像我拥有的​​所有 RewriteRules进入 RewriteRules 包括未被处理。

global.inc文件为空,我.htaccess文件中的 RewriteRules 工作正常。

任何线索我做错了什么?

4

1 回答 1

1

Try adding RewriteOptions directive into your .htaccess to allow executing rewrite rules on parent (upper) level.

http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteoptions

于 2012-05-22T17:41:44.110 回答