I have a blog that was setup in example.org/blog/
many years ago, so all its files are in /blog/
. Back then it seemed like a good idea, but now we want to slowly get rid of the subfolder.
Of course I could move the installation to the root folder /
, change the wordpress url in option and just move everything, add a htaccess redirect from /blog/*
to /*
so old links still work.
But we want to do it slowly because moving all the content at once would be a major risk and possible desaster for the Google rankings and traffic. 301/302 redirects are fine, but Google is not very happy if you move thousands of articles at once while the links stay the same. So new content first, then old stuff.
Is there any way to only publish new posts and pages in example.org/
instead of example.org/blog/
?
I’m capable of all kinds of hacks. I already have several blogs running with the WordPress installation in subfolders, have redirected and moved blogs all over the place and written scripts to change the values of all rows in a database table. Bring it on 🙂
Mmmm, I think that if you are thinking on a major change for the project, you could proceed as follow:
If your site is showing the counting of “social shares” to the visitor for any URL, that would definitely be an issue. But it is already solved and mimicking the approach recommended at Encosia should be enough if this is an issue for your project.
I think the best way, is that you change globaly, also the old post, remove the subfolder.
But I think it is also possible that you use the hook
publish_post
/_page
to change the rewrite rules for new posts/pages. Maybe you can learn on Toschos examples source to understand the rewrite possibilities, see his repo on github. But this generate also a performance topic. The logic must check on, if the post new, since date mm.yyyy and change ad hoc the permalink. Much more complex as a change globaly. Maybe it is better, that you enhance the old posts with a rewrite, that all posts also works from the old/blog/
url.