1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

301 redirect /forums/(root only) to /forum/

Discussion in 'XenForo Questions and Support' started by CivilWarTalk, Jan 1, 2012.

  1. CivilWarTalk

    CivilWarTalk Active Member

    Found an interesting issue after conversion from vB4. I used to have vB installed in the /forums folder. I now have xF installed in the root of the domain. I have xenPorta installed, so my forum listing is now at /forum/.

    Yesterday I discovered a few sites pointing to my old /forums/ folder (but not to a file, to the root of the folder) and realized that I got a "Forbidden" error when clicking on that link.

    So, I added this to my htaccess to redirect to the forum listing:

    Code:
    Redirect 301 /forums/ /forum/
    But, as I'm sure you can imagine, that did bad things to the xF pages located in the virtual /forums/ folder, so I had to comment it out.

    What I need is a 301 that redirects the root of /forums only, I'm not finding any helpful notes on the web. Does anyone have a clue what code I can dump in htaccess to get this sorted?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Put this at the top of your htaccess.

    Code:
    RedirectMatch 301 ^/forums/$ /forum/
    
    This will exactly match the /forums location. This URL will be redirected:

    http://www.yoursite.com/forums/

    This one will not:

    http://www.yoursite.com/forums/anythinghere
     
    dwdmadmac and CivilWarTalk like this.
  3. CivilWarTalk

    CivilWarTalk Active Member

    In trying to find a solution I remembered that I have a real /forums/ folder containing the vB redirect scripts. I was tempted to copy and rename forumdisplay.php to index.php, but I'm not sure that would do what I wanted...
     
  4. CivilWarTalk

    CivilWarTalk Active Member

    Ah, I'll try that! Thanks Jake!
     
  5. CivilWarTalk

    CivilWarTalk Active Member

    It works, thanks again!
     
  6. dwdmadmac

    dwdmadmac Active Member

    yes ty needed this! been looking for hrs
     

Share This Page