WEB forwarding from a subdomain URL?

Discussion in 'OT Technology' started by White Stormy, May 4, 2008.

  1. White Stormy

    White Stormy Take that, subspace!

    Joined:
    Sep 17, 2002
    Messages:
    85,486
    Likes Received:
    69
    Location:
    Sparkopolis
    I want to set up a subdomain URL for a subdirectory that already exists on my domain.

    example:
    have sub.domain.com forward to domain.com/sub

    I could do it with javascript.. but not everyone has javascript enabled.

    a .htaccess file tells the web server what page to load when someone goes to that URL, right? so can I just throw in a .htaccess that points to the subdirectory URL?

    if so, what do I put in it?
     
  2. White Stormy

    White Stormy Take that, subspace!

    Joined:
    Sep 17, 2002
    Messages:
    85,486
    Likes Received:
    69
    Location:
    Sparkopolis
  3. Bonken

    Bonken New Member

    Joined:
    Nov 21, 2007
    Messages:
    108
    Likes Received:
    0
    Location:
    Wales
    Wait what? When it comes to shit like that just forwarding I just slap in a index.html with re-direct.

    Code:
    [FONT=Arial, Helvetica][SIZE=2]<meta 			      HTTP-EQUIV="REFRESH" content="0; 			      url=http://www.yourdomain.com/index.html">
    Not sure if this is what you're after?
    [/SIZE][/FONT]
     
  4. White Stormy

    White Stormy Take that, subspace!

    Joined:
    Sep 17, 2002
    Messages:
    85,486
    Likes Received:
    69
    Location:
    Sparkopolis
    I didn't know about that :bigok: but nah, the benefit of doing it in the .htaccess is that any links from one will forward to the other as well..

    so sub.domain.com/dir/link.html redirects to domain.com/sub/dir/link.html without any errors or anything. they're basically interchangeable. and you only have to use 1 single .htaccess file per subdomain

    OT used to be like that.. you could use forums.offtopic.com or offtopic.com/forums
     
  5. Bonken

    Bonken New Member

    Joined:
    Nov 21, 2007
    Messages:
    108
    Likes Received:
    0
    Location:
    Wales
    ohh i see
     
  6. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    Do you have cpanel ?
     
  7. Half-Time

    Half-Time OT Supporter

    Joined:
    Mar 21, 2007
    Messages:
    6,460
    Likes Received:
    0
    Location:
    Houston
    cPanel just adds the redirects to the .htaccess for you
     
  8. White Stormy

    White Stormy Take that, subspace!

    Joined:
    Sep 17, 2002
    Messages:
    85,486
    Likes Received:
    69
    Location:
    Sparkopolis
    yeah but it won't let me forward from a subdomain to a domain subdirectory

    it'll let me go from domain subdirectory to subdomain, but not from subdomain to domain subdirectory

    it's because the option to select the URL to forward starts at the domain level and won't go backwards :hs:
     
  9. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,914
    Likes Received:
    8
    Location:
    Los Angeles
    <?php header("Location: domain.com/sub"); ?>
     

Share This Page