Using redirection with phpBB

Discussion in 'Apache' started by Voimis, Aug 9, 2009.

  1. #1
    Hi dudes! And thanks for reading, of course.

    What should I do to redirect everything from a folder to another (domain.com/forum/file-x.php to domain.com/somethingelse/file-x.php)?

    There is a phpBB forum installed there, does it make any difference?

    My webhotel has a cpanel in use so I can do the redirection through it, but is it worth it? What if I change to another company or something - the redirection should still work.

    So - using cpanel or doing it manually?

    Thanks,

    Voimis
     
    Voimis, Aug 9, 2009 IP
  2. kailash

    kailash Well-Known Member

    Messages:
    1,248
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    190
    #2
    Add the following code in your .htaccess file which is in public_html folder:

    redirectMatch 301 ^/forum/(.+)$ http://www.domain.com/somethingelse/$1

    Kailash
     
    kailash, Aug 9, 2009 IP
  3. kulinar

    kulinar Member

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #3
    What kind of redirect would you like to do - Internal (without changing the URLs) or external (changing URLs)?
     
    kulinar, Aug 15, 2009 IP
  4. Voimis

    Voimis Peon

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks kailash for your coude - but I had to do a little change to it:

    It didn´t work correctly ´til I changed + to *.

    So now it works.


    But here comes another guestion:

    How to redirect everything from http:// to http://www. ?
    So the whole site would run from http://www.
     
    Voimis, Aug 16, 2009 IP
  5. kailash

    kailash Well-Known Member

    Messages:
    1,248
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    190
    #5
    To redirect your domain to www, you can use following htaccess rule:

    rewritecond %{http_host} ^domain.com [nc]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

    If you have used without www URL in your forum, you may face the problem. Make sure that you change it from admin control panel.
     
    kailash, Aug 28, 2009 IP