.htaaccess codes to change forum directory locations

Discussion in 'Apache' started by SaN-DeeP, Oct 17, 2005.

  1. #1
    I was quite sure how to enable the same but unable to relocate the thread.

    Here is what i plan to acheive:

    A forum running on www.xyz.com
    plan to re-direct the entire forum to a sub-domain on abc.xyz.com
    how can i acheive this using a permanent 301 or 302 (best out of both) redirect ?


    more then 600,000 pages are already indexed via google, will there be any negative causes of using the same ?

    Thanks.
     
    SaN-DeeP, Oct 17, 2005 IP
  2. ServerUnion

    ServerUnion Peon

    Messages:
    3,611
    Likes Received:
    296
    Best Answers:
    0
    Trophy Points:
    0
    #2
    best bet it to keep where they are. If you do have to move them, 301 redirects are the best via mod_rewrite.

    Good luck...
     
    ServerUnion, Oct 17, 2005 IP
  3. SaN-DeeP

    SaN-DeeP Well-Known Member

    Messages:
    590
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    140
    #3
    can you give me exact codes for mod_rewrite ?
    since this vbulletin pages are dynamically generated, i want to move each and every thread/pages to new locations appropriately.
     
    SaN-DeeP, Oct 17, 2005 IP
  4. ServerUnion

    ServerUnion Peon

    Messages:
    3,611
    Likes Received:
    296
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I will have to look for that. I am sure someone will chime in soon on that. Should only be a few lines of code...
     
    ServerUnion, Oct 17, 2005 IP
  5. SaN-DeeP

    SaN-DeeP Well-Known Member

    Messages:
    590
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    140
    #5
    sweet, i will wait and search back for the thread, i used last time.

    Regards,
     
    SaN-DeeP, Oct 17, 2005 IP
  6. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #6
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^showthread.php?t=([^.]+)$ http://abc.domain.com/showthread.php?t=$1 [R=301,L]
     
    Nintendo, Oct 17, 2005 IP
  7. SaN-DeeP

    SaN-DeeP Well-Known Member

    Messages:
    590
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    140
    #7
    but this shall only help in re-directing anything related with showthread.php to get transferred/re-directed to sub-domain additional directory.

    I want to transfer all the indexed content from root www.xyz.com/ to forum.xyz.com or www.xyz.com/forum

    Thanks Nintendo.
     
    SaN-DeeP, Feb 28, 2006 IP
  8. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #8
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^([^.]+)$ http://forum.xyz.com/$1 [R=301,L]

    Everything will be moved there, even the index page of the domain..
     
    Nintendo, Feb 28, 2006 IP
  9. SaN-DeeP

    SaN-DeeP Well-Known Member

    Messages:
    590
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    140
    #9
    Thanks nintendo,
    How can i get the content re-directed to another directory
    www.xyz.com/forum/ ?
     
    SaN-DeeP, Feb 28, 2006 IP
  10. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #10
    Amazing. I was just thinking of this.

    Will this move from one folder to another?

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /forums/
    RewriteRule ^([^.]+)$ http://www.example.com/new_forums/$1 [R=301,L]

    Thanks
     
    noppid, Feb 28, 2006 IP
  11. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #11
    That'll add /new_forums/ to the URL of everything, if it doesn't cause an infinite loop every time it goes to a new URL.


    RewriteRule ^forum/([^.]+)$ http://www.domain.com/NEW-DIRECTORY/$1/ [R=301,L]

    for a different directory.
     
    Nintendo, Feb 28, 2006 IP
  12. SaN-DeeP

    SaN-DeeP Well-Known Member

    Messages:
    590
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    140
    #12
    wonderful out there..
    Last question:

    Since it is a forum, I have following pages on root folder /

    showthread.php (which leads to thousands of showthread.php?=xxxx pages)
    printthread.php (which leads to thousands of printthread.php?=xxxx pages)
    etc. etc.

    I am planning to add a custom CMS to the root folder, i am re-directing the entire forums to another sub-domain, wont the cms pages get re-directed as well ??

    thanks
     
    SaN-DeeP, Mar 1, 2006 IP
    Nintendo likes this.
  13. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #13
    With

    RewriteRule ^([^.]+)$

    the whole site get's moved. Only way around that is having a line for each type of URL you want moved. Like that

    RewriteRule ^showthread.php?t=([^.]+)$ http://abc.domain.com/showthread.php?t=$1 [R=301,L]

    code that only moves the threads.
     
    Nintendo, Mar 1, 2006 IP
    noppid likes this.
  14. SaN-DeeP

    SaN-DeeP Well-Known Member

    Messages:
    590
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    140
    #14
    thanks Nintendo for your time..
    time to implement your suggestions above and spend some time learning the rewrite rules.. (never thought those small alterations can do such miracles)
     
    SaN-DeeP, Mar 1, 2006 IP
  15. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #15
    You da man nino! ;)
     
    noppid, Mar 1, 2006 IP