如何WWW网址重定向到非www的网址与htaccess的? [英] how to redirect www url to non-www url with htaccess?

查看:108
本文介绍了如何WWW网址重定向到非www的网址与htaccess的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何重定向从 http://www.mysite.com 用户的 http://mysite.com 使用htaccess的,我不熟悉如何操作,才能做到这一点这个文件,任何人都可以帮助我做到这一点?

I wanted to know how to redirect users from http://www.mysite.com to http://mysite.com using htaccess, I'm not familiar in how to manipulate this file in order to do this, can anyone help me accomplish this?

在此先感谢。

推荐答案

这个网站给出一个完整的答案:

This site gives a complete answer:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^domain\.com
RewriteRule (.*) http://domain.com/$1 [R=301, L]

这是出现在我GOOGLE了它的第一件事情,所以我想你甚至懒得去寻找一个答案(顽皮的孩子,啧,啧!)。

It was the first thing that appeared when I googled for it, so I assume you didn't even bother to look for an answer (naughty boy, tsk, tsk!).

这篇关于如何WWW网址重定向到非www的网址与htaccess的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆