redirecting a domain to a subdomain or directory?

Discussion in 'Apache' started by RonnieT, Nov 2, 2006.

  1. #1
    I've used the only addon domain that my provider gave me so i'm hoping a 301 redirect will do the job here...

    I have a .com name and at the moment if the user types in the .com they get taken to where the (SMF) forum actually is; .co.uk/forum

    Is it possible to use 301 (or some other form of magic :D ) so that when people type in the .com they'll get the forum and the links within the forum will show .com/page.html ??

    OR;

    is it easier if i have the forum in a subdomain at .co.uk and redirect the .com to the subdomain rather than the forum directory ??

    Sorry for any confusion, i'm a complete n00b at 301's and .htaccess stuff :confused: :eek:
     
    RonnieT, Nov 2, 2006 IP
  2. thewindmaster

    thewindmaster The Man with the Plan

    Messages:
    845
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I was just coming to post this questions (or at least something similar as well)


    I have www.domain1.com on cpanel.
    I used an addon domain and set up www.domain2.com
    I set up redirection in the addon control panel for www.domain2.com to redirect to www.domain1.com/domain2 directory.

    Everything works but the URL in the address bar changes. I still want the address bar to read www.domain2.com when going there.

    Any help is appreciated.
     
    thewindmaster, Nov 3, 2006 IP
  3. WhiteHatHacker

    WhiteHatHacker Peon

    Messages:
    21
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    RonnieT, your post spun me out a treat :S :D

    I can answer thewindmaster's question straightforwardly, I think:

    If the control panel has saved the code in a .htaccess file, you're sorted. Just find the [R=301] or [L,R=301] or whatever bit, and delete the R=301 part - this'll leave nothing or [L] respectively for the examples I just gave.

    That SHOULD solve the problem.

    If it's saved in the httpd.conf... well, you need access. If you have got access, simply look for a similar clause. If not... try checking the control panel to see if it's got something along the lines of "disable 301 redirect" or whatever.

    :shrugs:

    Good luck.
     
    WhiteHatHacker, Nov 8, 2006 IP
  4. thewindmaster

    thewindmaster The Man with the Plan

    Messages:
    845
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Took your advice, white, but did not work.

    This is the current code in the htaccess in the directory:

    Any other advice?
     
    thewindmaster, Nov 9, 2006 IP
  5. melol2

    melol2 Active Member

    Messages:
    511
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #5
    Simple. Put this on domain1.com
    
    <?
    header('location:http://www.domain2.com')
    ?>
    
    Code (markup):
     
    melol2, Nov 9, 2006 IP