有和没有WWW的Apache重定向URL

时间:2015-06-24 03:56:18

标签: apache .htaccess mod-rewrite redirect rewrite

如何使用和不使用www重写URL。我的.htaccess中的以下代码会将d​​omain1.com重写为domain2.com,但不会重写www.domain1.com。

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain1.com
RewriteRule ^(.*)$ http://domain2.com/$1 [R=permanent,L]

1 个答案:

答案 0 :(得分:2)

    [Sat Jul 04 04:25:27 2015] [error] [client **.**.**.**] [host www.********.com] (104)Connection reset by peer: FastCGI: comm with server "/homez.***/***/www/webroot/index.php" aborted: read failed, referer: http://www.********.com/periods/112
    [Sat Jul 04 04:25:27 2015] [error] [client **.**.**.**] [host www.********.com] FastCGI: incomplete headers (0 bytes) received from server "/homez.***/***/www/webroot/index.php", referer: http://www.********.com/periods/112
    [Sat Jul 04 04:25:27 2015] [error] [client **.**.**.**] [host www.********.com] FastCGI: An error happend on Fastcgi processing, fallback to CGI, referer: http://www.********.com/periods/112