阿帕奇:如何从domain.com重定向到www.domain.com [英] Apache: How redirect from domain.com to www.domain.com
本文介绍了阿帕奇:如何从domain.com重定向到www.domain.com的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
阿帕奇:如何从domain.com重定向到www.domain.com
Apache: How redirect from domain.com to www.domain.com?
我不希望我的用户谁输入域W / O WWW被redicrect主www.domain
I dont want my users who type domain w/o www to be redicrect to the main www.domain
如何做到这一点,在哪里呢?本地的.htaccess或者Apache的配置(我有Ubuntu的服务器)
how to do it and where? local .htaccess or the apache config (I have Ubuntu server)
感谢
推荐答案
的.htaccess:
.htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
更多信息: http://enarion.net/web/ htaccess的/重定向WWW的和不带www /
这篇关于阿帕奇:如何从domain.com重定向到www.domain.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文