3

How do I redirect this:

www.sub.example.com

to this:

www.example2.com

How is this done -- 301? .htaccess? Can someone point me in the right direction please? My host is NearlyFreeSpeech and the domain I want to redirect to is quite a large site with a static IP.

4

2 回答 2

3

There are multiple ways to do this:

Other solutions are possible, and generally vary by server and configuration stack. I assume Apache compliance, given the presence of .htaccess in the problem statement.

Here's a Wikipedia reference on redirects via the 3xx family of HTTP status codes, if anyone's curious about the client's perspective.

于 2010-12-08T06:56:18.803 回答
1

Something like this should do it

RedirectPermanent / http://www.example2.com

RedirectPermanent would return a 301 code and force the client to go to www.example2.com, it works in apache config file and .htaccess file. You need mod_alias enabled to use it.

You can use this on the root directory of the subdomain in a .htaccess file, or in the virtualhost section of your apache configuration file.

For your reference the documentation

于 2010-12-08T06:55:13.207 回答