我有以下规则。WordPress上的htaccess文件(单次安装):
# REWRITE FORUMS DOMAIN TO FOLDER
RewriteCond %{HTTP_HOST} ^forums\\.example\\.com$
RewriteRule !^forums/? forums%{REQUEST_URI} [NC,L]
# REWRITE FORUMS FOLDER TO SUBDOMAIN
RewriteCond %{THE_REQUEST} \\s/forums/([^\\s]*) [NC]
RewriteRule ^ http://forums.example.com/%1 [R=301,L]
这是因为http://example.com/forums
访问地址http://forums.example.com/
然而,服务器突然出现500服务器错误。。。
有什么办法吗?These rules work perfectly when used on non-wordpress sites... 第二条重写规则成功地将/论坛发送到子域,但子域似乎无法将数据正确地传递到WordPress中。”
整个htaccess文件如下所示:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# REWRITE FORUMS DOMAIN TO FOLDER
RewriteCond %{HTTP_HOST} ^forums\\.example\\.com$
RewriteRule !^forums/? forums%{REQUEST_URI} [NC,L]
# REWRITE FORUMS FOLDER TO SUBDOMAIN
RewriteCond %{THE_REQUEST} \\s/forums/([^\\s]*) [NC]
RewriteRule ^ http://forums.example.com/%1 [R=301,L]
# BEGIN WordPress
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
</IfModule>
The reason that the WordPress rules are after the forums rules are because if I put them after then they are never hit!