server:linux(ubuntu)
add mod_rewrite:1、sudo a2enmod rewrite 2、udo vim /etc/apache2/sites-enabled/000-default
将其中的:
AllowOverride None
修改为:
AllowOverride All
重启生效。
将 htmldata.cn 转换为 www.htmldata.cn
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^htmldata.cn [nc]
rewriterule ^(.*)$ http://www.htmldata.cn/$1 [r=301,nc]