News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Moving forum root location to a different folder (URL Redirects)

Started by Goad, May 18, 2021, 08:02:21 PM

Previous topic - Next topic

Goad

Loyal SMF Fan here....My forum will be 15 years old in October. Been running it on SMF the whole time.

Right now its hosted at the root of my domain (Domain.com) and I would like to move it to Domain.com/Forum. I know this is totally easy to do in the forum settings, but the problem is I have 15 years of backlinks, hostage images, etc that I don't want to break. Is there an easy way to avoid this or is it just a decision to weigh out to keep it where it is vs move it and deal with the broken backlinks?

My end goal here is to have more of a website front end (ex Wordpress) then have a link to the forum, rather than the forum being the first thing they see. I am using EZ Portal, but it just isn't the vibe i want for my home page anymore.

I am all open to ideas/suggestions.

Ninja ZX-10RR

Tough one, had it been the other way around much easier but non-forum to forum url is... Very tricky with backlinks.
3rd party hosted images (if that's what you meant) won't be affected because they are an external site so that's out of the window at least.
Links... What links have you been using? Stuff like (random link here) https://www.simplemachines.org/community/index.php?board=147.0 ? Or any topic link? I do have an idea even though it's a bit of a weird one as I've never done that, but it may be possible to redirect all "site.com/index.php?" to "site.com/forum/index.php?" via .htaccess. I haven't had sleep in like 18h so it's probably not the correct time for me to write htaccess code, so I'll just wait for some details and whether I understood your situation correctly :)

Also crucial questions:
1) Do you use "Pretty URLs" mod?
2) Do you have "Search Engine friendly URLs" checkbox activated in action=admin;area=featuresettings;?
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Kindred

if you are just talking about links in messages (on your site)   then it's simple.

You can do a REPLACE in the smf_messages table, body column....

UPDATE smf_messages SET body=REPLACE(body,old_url,new_url);

for example

UPDATE smf_messages SET body=REPLACE(body,'yoursite.com','yoursite.com/forum');




If you are talking about backlinks from OTHER sites being redirected....    well, if you don't plan to put anything in your root folder, then it's just a simple htaccess forward. However, if you have to parse the URL and determine if it's supposed to go to the forum or stay in the root (because you have some new pages in the root) then things get complicated.

If you plan to put some other script in the root (like wordpress) then things get REALLY complicated
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Goad

Sorry for the super late reply...

I am using Pretty URL's

I am talking about links in the forum as well as from other sites.

...and yes, I am planning on using WordPress for my new root.

The objective is to avoid any interruption from links internally, like someone posted a link to a thread in another thread 5 years ago - I want that link to continue to work. Also, if someone posted a link on some other forum to a thread that is on my forum.

All while moving the forum from /index.php to /forum/index.php

-OR-

If there is a way to leave the forum in the root, but traffic thats intended for the forum is directed to the forum.

The ultimate goal here is when someone goes to mydomain.com, I want them to see wordpress initially. Not SMF. All of the SMF portals out there are just clunky and very limited with options.....and I'd like to clean up my homepage a bit.

Kindred

WordPress does not actually play nice with other scripts.

You have to move your forum..    and even then,  WordPress is going to intercept and break your links.

Fixing the links in YOUR database is easy.  Just do a replace SQL query to

Update smf_messages set body = replace (body, "old url", "new url");

This won't affect any links coming into your site from other places, though.
There is no good way to do that if you are putting WordPress in the root
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Aleksi "Lex" Kilpinen

If you do want to run both WP and SMF, I would suggest a separate subdomain for one of them.
SMF can work under Wordpress in a separate folder like /forum/ but that depends on your wordpress installs specifics so much that I wouldn't necessarily recommend that as the first option.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Goad

Quote from: Aleksi "Lex" Kilpinen on July 10, 2021, 01:45:03 AM
If you do want to run both WP and SMF, I would suggest a separate subdomain for one of them.
SMF can work under Wordpress in a separate folder like /forum/ but that depends on your wordpress installs specifics so much that I wouldn't necessarily recommend that as the first option.

Thats what I am trying to do, but trying to preserve 15 years of internal and external links.

I would like to move SMF from the root to /forum and I would like to install WP in the root.

Is there any .htaccess magic that can be done for url re-writes. Like if it detects its a link trying to access a SMF post, it will add /forum/ to the link?

shadav

Quote from: Goad on July 12, 2021, 02:24:30 PM
Quote from: Aleksi "Lex" Kilpinen on July 10, 2021, 01:45:03 AM
If you do want to run both WP and SMF, I would suggest a separate subdomain for one of them.
SMF can work under Wordpress in a separate folder like /forum/ but that depends on your wordpress installs specifics so much that I wouldn't necessarily recommend that as the first option.

Thats what I am trying to do, but trying to preserve 15 years of internal and external links.

I would like to move SMF from the root to /forum and I would like to install WP in the root.

Is there any .htaccess magic that can be done for url re-writes. Like if it detects its a link trying to access a SMF post, it will add /forum/ to the link?
not in this case no....since your forum was in the root, any redirects would redirect everything to the forum so your wordpress would be unusable
now if you have some popular posts you could do a 301 rewrite for each of them
RewriteRule ^the_posts's_old_url$ the_post's_new_url [R=301,L]

but unfortunately there's no easy way to redirect the root folder to a subfolder without making the root folder now obsolete.

Aleksi "Lex" Kilpinen

Also, WP does it's own magic and tries to capture all requests to it's folder - it's gonna be tricky, if not impossible.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Goad

ok, so I am abandoning this idea of moving the forum's root.

Is it possible to run a 100% custom home page?

I am wanting to make something completely modern. All of the "portal" mods are super dated and blah.

If you guys have any suggestions, let me know.

Mick.

Portal. Really you can take advantage of the portal with articles, ads, links with some css edits. My own forum (signature) I converted it to act and look like a blog. CSS man. Some portals have the ability to not use titles on blocks to which is a great deal for me. Find landing pages scripts and use that code. Codepen.io have plenty of ideas.

Advertisement: