Apache没有正确重定向'/usr/home/username/public_html/';


Apache not redirecting properly '/usr/home/username/public_html/'

我用它将非www请求重定向到www

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

它应该重定向自:

http://example.com/intranet

收件人:

http://www.example.com/intranet

但它正在重定向到:

http://www.example.com//usr/home/username/public_html/intranet

发生了什么,我该如何解决?

我已经成功地使用了以下内容:

RewriteBase /intranet/
RewriteCond %{HTTP_HOST}   !^www'. [NC]
RewriteRule ^(.*)          http://www.%{HTTP_HOST}/$1 [L,R]