Results 1 to 2 of 2

Thread: httaccess redirect one subdomain to another

  1. #1
    Join Date
    Aug 2009
    Posts
    4

    httaccess redirect one subdomain to another

    Hi there, I'm working on a new version of a site, and i've set it all up at
    test.mysite.com

    what I want to do, is create an .htaccess code so that poeple can view the site by going to
    www2.mysite.com

    then later, I wanted to do the same thing, and have it so people at www.mysite.com are actually being shown pages from test.mysite.com

    Sounds a bit confusing, but the site included many videos, and doing a redirect will save me from uploading and shifting hundreds and hundreds of MB around on the website

    Here's what I have so far:

    Code:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} www2.mysite.org.nz  [NC] 
    RewriteRule ^(.*)$ http://test.mysite.org.nz/$1 [L]
    This works, in that if you go to www2.mysite.org.nz it redirects to http://test.mysite.org.nz, but it's changing the URL the viewer sees. I don't want this, I want the viewer to think they're still at the www2 domain.

    Help appreciated.

    Jon

  2. #2
    Join Date
    Feb 2007
    Location
    Ireland
    Posts
    1,007
    I wouldn't do this with htaccess. I would create canonical names (cname) records with your domain registrar to do this. Makes things much handier on you. Who are your domain names registered with? If i'm familiar with them I may be able to provide you with instructions or a link to some instructions.

    Your logic seems to be flawed. You are rewriting www2.mysite.org.nz to test.mysite.org.nz. What you should be doing is rewriting test to www2. A cname is still the best way.
    “The best thing about a boolean is even if you are wrong, you are only off by a bit.”

Similar Threads

  1. 301 Redirect Question
    By robertuva in forum General Questions
    Replies: 0
    Last Post: 16 Oct 2008, 10:32 AM
  2. No-WWW 301 Redirect
    By sprsprmman in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 15 Mar 2008, 02:15 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •