Customize your theme in the Theme Customizer panel. See changes live without page reloading.   

Godaddy 主机利用.htaccess实现301重定向 www转向

当前位置:
估计的阅读时间: < 1分钟

昨天新买的godaddy主机,之前用的是国内主机自带301设置,可以直接将例如http://zhehaizi.com转向到带www的网址 http://localhost/host/fouzui,但是在godaddy后台设置比较难找,我找到的是在后台的hosting manage的URL Redirects,设置一番后网站打开错误,还是最终决定使用.htaccess实现301重定向实现www转向,代码如下:
RewriteEngine on
rewritecond %{http_host} ^fouzui.com [nc]
rewriterule ^(.*)$ http://localhost/host/fouzui/$1 [r=301,nc]
将代码中的网址换成自己的保存为.htaccess文件上传到网站根目录即可。
从Godaddy官方网站获得的,还有PHP ASP ASP.NET实现的方法:
http://www.dedebit.com/r/Godaddy-htaccess-301
访问官方网站查看更多,包含PHP、ASP、ASP.NET、.htaccess、IIS实现主机服务器重定向

这篇文章有帮助吗?
浏览: 0
Call to action title here