Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: TrentT on July 23, 2014, 05:45:23 PM

Title: Moving SMF to a different folder error
Post by: TrentT on July 23, 2014, 05:45:23 PM
Hey there again,

I'm trying to move my SMF from the public_html to a folder inside the public_html, but the layout looks bugged and everytime I click on something, it redirects me to a page (error) as it would be in the public_html.

For example, a link redirects me to:
website.com/index.php

while it should be:
website.com/community/index.php

I have tried running a repair_settings.php in the same folder as Settings.php but that didn't work out for me. There is also a link on top which says: ''The default theme's directory is wrong, please correct it by clicking this text.'' but clicking that, doesn't fix my problem.

From what I could've seen, I can say that the database paths are all correct.

Any thoughts?
Title: Re: Moving SMF to a different folder error
Post by: Justyne on July 23, 2014, 05:48:23 PM
what does it actually suggest as the path? Maybe, that's not correct.

Obviously it should have your new subfolder in it.

Are you sure you moved all the files?
Title: Re: Moving SMF to a different folder error
Post by: TrentT on July 23, 2014, 05:50:39 PM
Yes, I'm sure that I've moved all possible folders and files to the new folder. At the moment, the links are acting as the files and folders would be in the public_html (website.com/**filehere**) instead of ''community'' in between (website.com/community/**filehere**)
Title: Re: Moving SMF to a different folder error
Post by: Justyne on July 23, 2014, 05:55:10 PM
then put the community in there and that should fix it.
Title: Re: Moving SMF to a different folder error
Post by: margarett on July 23, 2014, 05:56:19 PM
That's something repair_settings should fix.
You said it didn't work out, what exactly happened?
Title: Re: Moving SMF to a different folder error
Post by: TrentT on July 23, 2014, 06:15:47 PM
Quote from: Justyne on July 23, 2014, 05:55:10 PM
then put the community in there and that should fix it.

Yeah well, your comment is not helping me at all.


Quote from: margarett on July 23, 2014, 05:56:19 PM
That's something repair_settings should fix.
You said it didn't work out, what exactly happened?

I downloaded the repair_settings from this page (http://wiki.simplemachines.org/smf/Repair_settings.php), directly from the download section without changing any values. I uploaded (and removed afterwards) it to the /community sub-directory, but it still looks bugged.
Title: Re: Moving SMF to a different folder error
Post by: Arantor on July 23, 2014, 06:17:46 PM
It won't magically fix anything just by putting it there. You have to use it to change the values, to include community.
Title: Re: Moving SMF to a different folder error
Post by: Justyne on July 23, 2014, 06:19:09 PM
you might have to change the values. Check the paths displayed in repair settings and if they actually point to the correct places.

If your path is public_html/community you should see this in the paths of repair settings. If its not there put it there and save.
Title: Re: Moving SMF to a different folder error
Post by: margarett on July 23, 2014, 06:32:55 PM
Quote from: ‽ on July 23, 2014, 06:17:46 PM
It won't magically fix anything just by putting it there. You have to use it to change the values, to include community.
^^ This ;)

The wiki should help you understand better what to do with it.
What is repair_settings.php? (http://wiki.simplemachines.org/smf/Repair_settings.php)
Title: Re: Moving SMF to a different folder error
Post by: TrentT on July 23, 2014, 06:46:18 PM
Oh wow, I forgot to actually head over to the file (/community/repair_settings.php) and set the paths manually. I thought it would somehow fix everything automatically, but after reading that topic and your comments again, I got it figured now.

Thanks alot for the quick responses guys! ;)
Title: Re: Moving SMF to a different folder error
Post by: Justyne on July 23, 2014, 06:49:50 PM
Glad we could help. Anytime.
Title: Re: Moving SMF to a different folder error
Post by: margarett on July 23, 2014, 06:50:32 PM
Nice ;) Don't forget to immediately remove the file after using it!
Title: Re: Moving SMF to a different folder error
Post by: Bob Perry of Web Presence Consulting on July 24, 2014, 04:26:16 AM
yea and even if you forget the system will tell you next time the admin logs in...

extremely useful tool...
Title: Re: Moving SMF to a different folder error
Post by: TrentT on July 24, 2014, 04:39:48 AM
Eh, so after I moved the forum to the /community sub-directory, you will get alot of dead links in topics aswell. Any ideas on how to fix that?
Title: Re: Moving SMF to a different folder error
Post by: Bob Perry of Web Presence Consulting on July 24, 2014, 05:00:34 AM
All your internal links should be fine, if there are broken external links, then I would guess that they were messed up -before- the move as well.

would you post a link to your site and let's have a looksee?

Title: Re: Moving SMF to a different folder error
Post by: TrentT on July 24, 2014, 05:24:43 AM
Quote from: Bob Perry on July 24, 2014, 05:00:34 AM
All your internal links should be fine, if there are broken external links, then I would guess that they were messed up -before- the move as well.

would you post a link to your site and let's have a looksee?

Here's an example of what I mean:
http://www.avttdm.com/community/index.php/topic,5770.msg41521.html#msg41521

Old topics which are still reffering to the old links, didn't get updated automatically. External links are fine as those didn't change.

Note: If you look around the forum, you might notice that some links are correct. I updated them by hand.
Title: Re: Moving SMF to a different folder error
Post by: Arantor on July 24, 2014, 05:25:36 AM
There's no automated way to do that, mostly because doing find/replace on a database is a heavily nasty operation to do - since it has to go through the entire database post by post and all the time it's doing that, it's not letting anyone else look at posts.
Title: Re: Moving SMF to a different folder error
Post by: Yazar8 on July 24, 2014, 05:28:36 AM
Quote from: ‽ on July 24, 2014, 05:25:36 AM
There's no automated way to do that, mostly because doing find/replace on a database is a heavily nasty operation to do - since it has to go through the entire database post by post and all the time it's doing that, it's not letting anyone else look at posts.

If we were going to do this, what query would I need to execute?
Title: Re: Moving SMF to a different folder error
Post by: Justyne on July 24, 2014, 05:34:25 AM
Yazar, I don't recall the table names off the top of my head but somewhat like this

UPDATE messages
SET posts = REPLACE(posts, 'string1', 'string2')
WHERE posts LIKE '%string1%'
Title: Re: Moving SMF to a different folder error
Post by: Arantor on July 24, 2014, 05:42:39 AM
Yup, that's the general format.

UPDATE smf_messages
SET body = REPLACE(body, 'yourdomainhere.com/index.php', 'yourdomainhere.com/community/index.php')
WHERE body LIKE '%yourdomainhere.com/index.php%';


And then wait.
Title: Re: Moving SMF to a different folder error
Post by: Yazar8 on July 24, 2014, 05:44:29 AM
Quote from: Justyne on July 24, 2014, 05:34:25 AM
Yazar, I don't recall the table names off the top of my head but somewhat like this

UPDATE messages
SET posts = REPLACE(posts, 'string1', 'string2')
WHERE posts LIKE '%string1%'

UPDATE avttdmc2_forummessages
SET body = REPLACE(body, 'avttdm.com/index.php', 'avttdm.com/community/index.php')
WHERE body LIKE '%avttdm.com/index.php%'

Is this correct?

Edit: Question mark answered me, meh. Lemme try this.
Title: Re: Moving SMF to a different folder error
Post by: Arantor on July 24, 2014, 05:46:45 AM
That's 'interrobang' ;)

But yes, that's the way to do it :)
Title: Re: Moving SMF to a different folder error
Post by: Yazar8 on July 24, 2014, 05:49:50 AM
 O:)
Quote from: ‽ on July 24, 2014, 05:46:45 AM
That's 'interrobang' ;)

But yes, that's the way to do it :)

Ah sorry. I learned something new :P

Anyway I executed this query it did its job in 1-2 seconds. Didn't take that long. There were only 479 posts like that.

Though I also need to change them on the topics, because this query only changes replies.
Title: Re: Moving SMF to a different folder error
Post by: Bob Perry of Web Presence Consulting on July 24, 2014, 05:50:28 AM
might be a good idea to put your forum into maintenance mode first, should something go awry

Title: Re: Moving SMF to a different folder error
Post by: Arantor on July 24, 2014, 05:51:10 AM
QuoteThough I also need to change them on the topics, because this query only changes replies.

No. The smf_messages table contains every post in the forum, including the first post in topics.
Title: Re: Moving SMF to a different folder error
Post by: Yazar8 on July 24, 2014, 05:52:58 AM
Quote from: ‽ on July 24, 2014, 05:51:10 AM
QuoteThough I also need to change them on the topics, because this query only changes replies.

No. The smf_messages table contains every post in the forum, including the first post in topics.

Oh alright. Then


Yeah my forum is still on maintenance mode and I'm going to keep it on it for a few more minutes just incase the query didnt finish.
Title: Re: Moving SMF to a different folder error
Post by: Arantor on July 24, 2014, 05:53:21 AM
If it came back to you, it finished already.
Title: Re: Moving SMF to a different folder error
Post by: Yazar8 on July 24, 2014, 05:55:09 AM
Quote from: ‽ on July 24, 2014, 05:53:21 AM
If it came back to you, it finished already.

Yeah I got the response, its completed. Good job : D

Thanks to everyone for their help.

Trent mark this as solved pls.
Title: Re: Moving SMF to a different folder error
Post by: Arantor on July 24, 2014, 05:58:11 AM
Sub 500 posts shouldn't take a long time. It gets slower the more/longer posts you have, roughly proportional to the total amount of content it has to wade through.
Title: Re: Moving SMF to a different folder error
Post by: TrentT on July 24, 2014, 05:58:40 AM
Alright, everything seems to work fine now.

Thanks again for your time and quick responses ;)
Title: Re: Moving SMF to a different folder error
Post by: Justyne on July 24, 2014, 06:02:59 AM
Glad we could help.
Title: Re: Moving SMF to a different folder error
Post by: Kindred on July 24, 2014, 07:13:41 AM
also... form your urls, it looks like you have that silly "SEF" checkbox checked...      I recommend unchecking that. it is pointless, serves no real purpose, and often confuses things later on.  (it's left over from years ago when search engines had to have an .html marked page to understand how to catalog it)
Title: Re: Moving SMF to a different folder error
Post by: Arantor on July 24, 2014, 07:25:17 AM
You should see how much effort I had to go to in this current mod project to specifically work around that nonsense.
Title: Re: Moving SMF to a different folder error
Post by: kat on July 24, 2014, 07:36:24 AM
Nicely sorted, guys'n'gal!