每服务器不工作
问题描述:
的RewriteRules我有一个虚拟主机指令中/etc/apache2/openpanel.d/www.example.com.conf
:每服务器不工作
<VirtualHost *:80>
ServerAdmin "[email protected]"
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]
但是RewriteRule包含文件(RewriteRules)中的s似乎不被解析/使用。
该文件正在被包含,因为我可以把非允许的东西放在那里,Apache将无法加载配置文件,但如果我打开Apache重定向日志记录,那么我只看到[perdir]行,好像所有的我在RewriteRules包含的RewriteRules没有被处理。
global.inc
文件是空的,我的.htaccess
文件中的RewriteRules工作正常。
任何线索我在做什么错?
答
尝试增加RewriteOptions
指令到你的.htaccess允许在父(上)水平上执行重写规则。
http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteoptions
不是100%肯定这是否会实际工作(没有获得工作的Apache实例来检查),但...尝试添加'RewriteOptions'指令到您的.htaccess - HTTP:/ /httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteoptions – LazyOne
@LazyOne天才!这工作,非常感谢!随意添加,作为答案,我会接受它。 – Jon