• 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/

#1
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?
 

Jake Bunce

XenForo moderator
Staff member
#2
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
 
#3
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
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
Ah, I'll try that! Thanks Jake!
 

dwdmadmac

Active member
#6
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
yes ty needed this! been looking for hrs