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

XF 1.2 Forum in index but moving to "community"

Neal

Well-known member
#1
I've moved my forum from my site root to a folder called "community". I want to redirect everything at mydomain.com to the new forum/thread locations with a 301.

I've tried doing it via cpanel but I get a message stating it can't be done due to redirect looping.

I currently have an index.php file in the root forwading to the "community" folder (But this doesn't redirect the old threads/urls/etc...). I've also edited the default XenForo .htaccess to remove the www. from the domain so http://www.mysite.com/community/ becomes http://mysite.com/community/.

Help appreciated please :)
 

Tracy Perry

Well-known member
#2
I've moved my forum from my site root to a folder called "community". I want to redirect everything at mydomain.com to the new forum/thread locations with a 301.

I've tried doing it via cpanel but I get a message stating it can't be done due to redirect looping.

I currently have an index.php file in the root forwading to the "community" folder (But this doesn't redirect the old threads/urls/etc...). I've also edited the default XenForo .htaccess to remove the www. from the domain so http://www.mysite.com/community/ becomes http://mysite.com/community/.

Help appreciated please :)
Are you totally removing the forum from the root and over to /community? What does the index.php in root consist of (is it the forum index.php - in which case is not going to work)?
Most times you move your forum over, modify your web servers to use the new directory as the base <the root location> (unless you are putting a Wiki or something in the root and then making a link to the forum from it or bridging it) and that's pretty much it. If you are doing the latter then your index.php should not have any redirects in it - but your .htaccess may need rewrites.
 

Tracy Perry

Well-known member
#4
My index.php at the moment:
I'm not having anything in the root at this time but may add a basic page or a CMS at some point. I just like it being more organised and having the forum in its own folder/area.
Probably the easiest thing to do right now would be simply make the /community your root for your web server - and once you install the CMS then you can change it back to being wherever it is now.
The .htaccess in the root is probably going to need to be edited to control the rewrites to the correct location for you now instead of using a PHP file. That's probably what is causing your loops.
 

Neal

Well-known member
#5
Probably the easiest thing to do right now would be simply make the /community your root for your web server - and once you install the CMS then you can change it back to being wherever it is now.
The .htaccess in the root is probably going to need to be edited to control the rewrites to the correct location for you now instead of using a PHP file. That's probably what is causing your loops.
I tried doing it via .htaccess but it gave me a loop error so I changed to the index.php file but really I need everything going to my root going to /community/
 

Tracy Perry

Well-known member
#6
Did you try something like this in your .htaccess?
Code:
RedirectMatch 301 ^/(.*)$ http://www.site.com/community/$1
And be sure that the .htaccess is not defined in your /community also.
 

Neal

Well-known member
#7
Did you try something like this in your .htaccess?
Code:
RedirectMatch 301 ^/(.*)$ http://www.site.com/community/$1
And be sure that the .htaccess is not defined in your /community also.
So put that into a new .htaccess in the root of the site and leave the one in /community/ alone?
 

Tracy Perry

Well-known member
#8
So put that into a new .htaccess in the root of the site and leave the one in /community/ alone?
Put it in the root one and rename the one in /community as .htaccess.old. You may be able to just move the one from the /community into the root and see if that works (with that rewrite rule near the top). I use nginx so I'm not real familiar with apache's rewrite rules like I am nginx. @Jake Bunce is one of the rewrite rule gurus.
 

Neal

Well-known member
#11
I appreciate the help but I'm getting confused and still having some issues. I'll open up a ticket and see if XenForo staff can help :)
 

Jake Bunce

XenForo moderator
Staff member
#12
Put this in your .htaccess file in the web root:

Code:
RewriteEngine On

RewriteRule ^(threads|forums|members)/(.*)$ /community/$1/$2 [R=301,L]
You need to specify each XenForo route that you want to redirect to the new location. I included the important routes above. The rest don't matter as much.
 

Tracy Perry

Well-known member
#13
Put this in your .htaccess file in the web root:

Code:
RewriteEngine On

RewriteRule ^(threads|forums|members)/(.*)$ /community/$1/$2 [R=301,L]
You need to specify each XenForo route that you want to redirect to the new location. I included the important routes above. The rest don't matter as much.
Yay!!!!! Jake to save the day!!!
Jake, does he still need his default .htaccess in the root of his old directory or a new one and keep the old one in the /community? Or should he delete the /community one?