htaccess

Discussion in 'Site & Server Administration' started by tony84, Apr 23, 2007.

  1. #1
    I used to know how to do this but because i do it very rarely.

    i have my site and ive installed some forums. which i installed under sitename.com/forums because the site has been like that for a while i dont want to change the directory so its under sitename.com because it has all ben idexed now.

    So what i want is when someone type in sitename.com it really goes to sitename.com/forums/homepage.html

    I hope that makes sense.
     
    tony84, Apr 23, 2007 IP
  2. chops

    chops Well-Known Member

    Messages:
    199
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    140
    #2
    Add this line to the htaccess
    Redirect 301 /forum http://www.sitename.com

    Then move your forum into the homepage directory. The search engines will learn the change of address in a search engine friendly way.
    Or at least that's my understanding of it!
     
    chops, Apr 23, 2007 IP
  3. login

    login Notable Member

    Messages:
    8,849
    Likes Received:
    349
    Best Answers:
    0
    Trophy Points:
    280
    #3
    RewriteEngine on
    Redirect 301 /index.html http://www.mydomain.info/folder

    Something like this. Don\ t remember accurately. Try.

    EDIT: Yes, chops is right. In the long run, if you want the forum to be in the root his suggestion is best.
     
    login, Apr 23, 2007 IP
  4. tony84

    tony84 Well-Known Member

    Messages:
    1,864
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    140
    #4
    im not bothered about the forums being in the root directory i just want the site to load up sitename.com/forums/homepage.html first in the easiest possible way
     
    tony84, Apr 23, 2007 IP
  5. login

    login Notable Member

    Messages:
    8,849
    Likes Received:
    349
    Best Answers:
    0
    Trophy Points:
    280
    #5
    Hehe, some one with 4 greens gave me a red AND a happy smiley in this thread. Funny.
     
    login, Apr 23, 2007 IP
  6. tony84

    tony84 Well-Known Member

    Messages:
    1,864
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    140
    #6
    tony84, Apr 23, 2007 IP
  7. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #7
    There are a number of ways to do this:
    1) mod_rewrite, placed in a .htaccess file in the root folder of your domain (mysite.com/.htaccess)
    Options +FollowSymLinks
    RewriteEngine On
    RewriteRule ^$ http://www.mysite.com/forums/homepage.html [R=301,L]
    Code (markup):
    2) mod_alias - using Redirect commands as suggested above.

    3) Use an index script that sends out the redirect header - as you're only wanting to redirect one page, this option would make most sense to me. Depends on what you have available but with PHP you could simply create an index.php file at mysite.com/index.php and put inside:
    <?php
    header('HTTP/1.1 301 Moved Permanently');
    header('Location: http://www.mysite.com/forums/homepage.html'); 
    ?>
    PHP:
     
    rodney88, Apr 24, 2007 IP
  8. tony84

    tony84 Well-Known Member

    Messages:
    1,864
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    140
    #8
    its also my PR, my homepage has an ok PR and i want that to be transfered to mysite.com/forums/newhomepage not transferred but for it to appear as though the new homepage has the PR
     
    tony84, Apr 24, 2007 IP
  9. login

    login Notable Member

    Messages:
    8,849
    Likes Received:
    349
    Best Answers:
    0
    Trophy Points:
    280
    #9
    When you redirect 301, the PR will also be redirected. So if you redirect domain.com with PR3 to domain.com/forum, the forum will be PR3 in the future.
     
    login, Apr 24, 2007 IP
  10. tony84

    tony84 Well-Known Member

    Messages:
    1,864
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    140
    #10
    Id rather it just be when i type in www.mysite.com it displays mysite.com/forums/homepage there was a different script i used id probably know it if i seen it
     
    tony84, Apr 24, 2007 IP
  11. login

    login Notable Member

    Messages:
    8,849
    Likes Received:
    349
    Best Answers:
    0
    Trophy Points:
    280
    #11
    I do not understand what you want.
    For mysite.com to display the content of mysite.com/forums/homepage you have to move all the files, but that is not what you want right ?
    You can also iframe mysite.com/forums/homepage and display it on mysite.com, but that would be strange to do ?
    You do not want that when somebody types domain.com they are send to mysite.com/forums/homepage , right ?
     
    login, Apr 24, 2007 IP