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

XF 1.2 Please Help - Moved Forum from /forums to root

#1
Hi everyone,

I moved my forums from the /forums directory to the main root directory.

I am having crawl errors in my google webmaster tools. It still trys to fetch the urls in the /forum directory.

How can I have all the indexed pages that google has of my forum redirect to my new one? I did some searching, and I think I need to modify the .htaccess file, but not sure how or what to insert...

Thank you very much for your time.
 
#2
This is what I have tried and didn't work. Unless I need give it some time or do something for it to start working?

I added this in the .htaccess in the main root.

RewriteRule ^forums(/.*)?$ /$1 [L,NC,R=301]
 
#3
Ok so that RewriteRule I posted above works, but you must have it as the first rule under RewriteEngine On.

So all my threads started redirecting fine. Example:
www.site.com/forums/thread/thread-topic/
would redirect to
www.site.com/thread/thread-topic/

Perfect, but now I have another problem.... :(

Now my forum categories are broken... I am not sure how to fix this.

On my main forum, I have categories like General Discussions, News, Gallery, etc.

If you click on General Discussions, the URL will be: www.site.com/forums/general-discussions.3/

So with the new RewriteRule, this gets broken.

So is there anything I can do to redirect my threads without affecting the categories?
 
#7
Yes the way I fixed it was I had to disable Full Friendly URLs.

If I enable it, the categories will return an error page with the Rewrite code I put in .htaccess to redirect my threads.

If I enable Full Friendly URLs and remove the Rewrite code, everything will work fine. The issue I am having is google has indexed the threads from the /forums directory and return an error when it trys to crawl it. I completely lost my ranking on google when I moved my forum from /forums to the root directory. So I am trying to fix it.

Hope I am making sense.
 

Brogan

XenForo moderator
Staff member
#8
Ah, I see the issue now.
When you say "categories", what you actually mean is "forums", hence my confusion.

You originally had it installed in /forums and now that you have moved it to the root, trying to redirect /forums to the root is interfering with the default /forums route.

I'm not sure if it's possible to do a general rewrite but exclude a specific route so you may need to add more explicit rules for each route, such as forums/threads, forums/forums, forums/members, etc.
 
#9
Ah yes, don't know why I didn't think of it before.

I changed the rewrite code to this:
RewriteRule ^forums(/threads/.*)?$ /$1 [L,NC,R=301]

All seems to be working fine now.

Thank you!