.htaccess 虚拟主机或htaccess不再将非www重定向到www

.htaccess 虚拟主机或htaccess不再将非www重定向到www,.htaccess,redirect,web,virtual,host,.htaccess,Redirect,Web,Virtual,Host,在服务器从debian 6重新安装到debian 7之后,我们的一个页面停止了将非www重定向到www版本。奇怪的是,在所有其他虚拟主机上,它工作得非常好 此处显示虚拟主机(已启用): 服务器管理员info@ravand.org 服务器名ravand.org ServerAlias*.ravand.org DocumentRoot/var/www/ravand.org/forum/ ErrorLog/var/log/apache2/ravand.org/ravand.org_error.log

在服务器从debian 6重新安装到debian 7之后,我们的一个页面停止了将非www重定向到www版本。奇怪的是,在所有其他虚拟主机上,它工作得非常好

此处显示虚拟主机(已启用):


服务器管理员info@ravand.org
服务器名ravand.org
ServerAlias*.ravand.org
DocumentRoot/var/www/ravand.org/forum/
ErrorLog/var/log/apache2/ravand.org/ravand.org_error.log
CustomLog/var/log/apache2/ravand.org/ravand.org\u access.log组合
这里是我们的.htaccess:

DirectoryIndex index.php?page=Portal
# WCF-SEO-START
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /
RewriteCond %{HTTP_HOST} ^ravand.org$
RewriteRule (.*) http://www.ravand.org/$1 [R=301,L] 

RewriteRule ^tag/([0-9]+)\-([^/\.]*)/?$ index.php?page=TaggedObjects&tagID=$1 [L,QSA]
RewriteRule ^user/([0-9]+)/([^/\.]*)/?$ index.php?page=User&userID=$1&username=$2 [L,QSA]
RewriteRule ^([^/\.]+/)*([^/\.]+)/([0-9]+)\-([^/\.]*)/last\-post\.html$ index.php?page=Thread&threadID=$3&action=lastPost [L,QSA]
RewriteRule ^([^/\.]+/)*([^/\.]+)/([0-9]+)\-([^/\.]*)/first\-new\-post\.html$ index.php?page=Thread&threadID=$3&action=firstNew [L,QSA]
RewriteRule ^([^/\.]+/)*([^/\.]+)/p([0-9]+)\-([^/\.]*)/?$ index.php?page=Thread&postID=$3 [L,QSA]
RewriteRule ^([^/\.]+/)*([^/\.]+)/([0-9]+)\-([^/\.]*)/index([0-9]+)\.html$ index.php?page=Thread&threadID=$3&pageNo=$5 [L,QSA]
RewriteRule ^([^/\.]+/)*([^/\.]+)/([0-9]+)\-([^/\.]*)/?$ index.php?page=Thread&threadID=$3 [L,QSA]
RewriteRule ^([^/\.]+/)*([^/\.]+)/index([0-9]+)\.html$ index.php?page=Board&boardTitle=$2&pageNo=$3 [L,QSA]
RewriteRule ^([^/\.]+/)*([^/\.]+)/?$ index.php?page=Board&boardTitle=$2 [L,QSA]
RewriteRule ^([^/\.]+)\.html$ index.php?page=Index [L,QSA]
</IfModule>
# WCF-SEO-END
DirectoryIndex.php?page=Portal
#WCF-SEO-START
重新启动发动机
重写基/
重写cond%{HTTP_HOST}^ravand.org$
重写规则(.*)http://www.ravand.org/$1[R=301,L]
重写规则^tag/([0-9]+)\-([^/\.]*)/?$index.php?page=TaggedObjects&tagID=$1[L,QSA]
重写规则^user/([0-9]+)/([^/\.]*)/?$index.php?page=user&userID=$1&username=$2[L,QSA]
重写规则^([^/\.]+/)*([^/\.]+/([0-9]+)\-([^/\.]*)/last \-post\.html$index.php?page=Thread&threadID=$3&action=lastPost[L,QSA]
重写规则^([^/\.]+/)*([^/\.]+/([0-9]+)\-([^/\.]*)/first \-new \-post\.html$index.php?page=Thread&threadID=$3&action=firstNew[L,QSA]
重写规则^([^/\.]+/)*([^/\.]+)/p([0-9]+)\-([^/\.]*)/?$index.php?page=Thread&postID=$3[L,QSA]
重写规则^([^/\.]+/)*([^/\.]+)/([0-9]+)\-([^/\.]*)/index([0-9]+)\.html$index.php?page=Thread&threadID=$3&pageNo=$5[L,QSA]
重写规则^([^/\.]+/)*([^/\.]+)/([0-9]+)\-([^/\.]*)/?$index.php?page=Thread&threadID=$3[L,QSA]
重写规则^([^/\.]+/)*([^/\.]+)/index([0-9]+)\.html$index.php?page=Board&boardTitle=$2&pageNo=$3[L,QSA]
重写规则^([^/\.]+/)*([^/\.]+)/?$index.php?page=Board&boardTitle=$2[L,QSA]
重写规则^([^/\.]+)\.html$index.php?page=index[L,QSA]
#WCF-SEO-END
当您尝试在没有www的情况下连接到该页面时,它只会提供来自apache2的标准“此处无需查看”消息 此配置在重新安装之前正常工作,那么这可能是什么原因呢

此外,重写引擎已打开

提前谢谢
ravand

您是否移动了文档根目录?htaccess位于何处?不,一切都与以前完全相同。htaccess位于/var/www/ravand.org/forum/
DirectoryIndex index.php?page=Portal
# WCF-SEO-START
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /
RewriteCond %{HTTP_HOST} ^ravand.org$
RewriteRule (.*) http://www.ravand.org/$1 [R=301,L] 

RewriteRule ^tag/([0-9]+)\-([^/\.]*)/?$ index.php?page=TaggedObjects&tagID=$1 [L,QSA]
RewriteRule ^user/([0-9]+)/([^/\.]*)/?$ index.php?page=User&userID=$1&username=$2 [L,QSA]
RewriteRule ^([^/\.]+/)*([^/\.]+)/([0-9]+)\-([^/\.]*)/last\-post\.html$ index.php?page=Thread&threadID=$3&action=lastPost [L,QSA]
RewriteRule ^([^/\.]+/)*([^/\.]+)/([0-9]+)\-([^/\.]*)/first\-new\-post\.html$ index.php?page=Thread&threadID=$3&action=firstNew [L,QSA]
RewriteRule ^([^/\.]+/)*([^/\.]+)/p([0-9]+)\-([^/\.]*)/?$ index.php?page=Thread&postID=$3 [L,QSA]
RewriteRule ^([^/\.]+/)*([^/\.]+)/([0-9]+)\-([^/\.]*)/index([0-9]+)\.html$ index.php?page=Thread&threadID=$3&pageNo=$5 [L,QSA]
RewriteRule ^([^/\.]+/)*([^/\.]+)/([0-9]+)\-([^/\.]*)/?$ index.php?page=Thread&threadID=$3 [L,QSA]
RewriteRule ^([^/\.]+/)*([^/\.]+)/index([0-9]+)\.html$ index.php?page=Board&boardTitle=$2&pageNo=$3 [L,QSA]
RewriteRule ^([^/\.]+/)*([^/\.]+)/?$ index.php?page=Board&boardTitle=$2 [L,QSA]
RewriteRule ^([^/\.]+)\.html$ index.php?page=Index [L,QSA]
</IfModule>
# WCF-SEO-END