伪静态做个记录

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

 

RewriteEngine On
RewriteCond %{HTTP_HOST} !^my-domain\.com$ [NC]
RewriteRule ^(.*)$ http://my-domain.com/$1 [R=301,L]

参考来自 http://dense13.com/blog/2008/02/27/redirecting-non-www-to-www-with-htaccess/

nginx的下面

http://stackoverflow.com/questions/1629231/nginx-rewrite-non-www-prefixed-domain-to-www-prefixed-domain

发表评论

电子邮件地址不会被公开。 必填项已用*标注