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.

izolate
  • 1,590
  • 4
  • 22
  • 35

2 Answers2

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.

MrGomez
  • 23,788
  • 45
  • 72
  • Well I'm quite familiar with CNAME records, since I had to modify them to set up Google Apps. So, I think I'll follow this route. Thank you! – izolate Dec 08 '10 at 06:59
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

RageZ
  • 26,800
  • 12
  • 67
  • 76
  • Where does this go? Sorry- I'm a little new to all this. – izolate Dec 08 '10 at 06:56
  • 1
    @yatman: depend how his your setup but the easiest would probably create a .htaccess on the root directory of your subdomain website and add the directive of my answer – RageZ Dec 08 '10 at 06:59