1

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 :)

0

2 Answers 2

1

Mmmm, I think that if you are thinking on a major change for the project, you could proceed as follow:

  1. Of course, create a development snapshot of your site, somewhere else. Fork files and database, You can even fool the development vhost and the developer client so you dont even need to change the url-related parameters in the wp_options table of the database.
  2. In the database, replace every pattern of "http://mydomain.tld/blog/" for "http://mydomain.tld/". Keep in mind that you may have a few variations of this pattern (with/without www, with/without https, etc.).
  3. After performing those tasks, you could move all the files and set a single Redirect rule to move the whole blog, with updated intra-links fitting the new url pattern and therefore not annoying google :)

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.

3
  • Thanks for your answer, but that sounds more like a normal 'move' of the blog, right? Fixing the internal linking won't fix the thousands of external links. They are what is most important for search engines. For Google and Co still all the content is in a new place and changed. We don't want to "upset" them in any possible way, so that's not an option. I really just need a way to move new content to / and keep all the old stuff exactly how it was before.
    – janpio
    Oct 1, 2013 at 13:10
  • 1
    Ok @JanP. if you cannot use a 301 redirect then I think I have no other ideas :(
    – versvs
    Oct 1, 2013 at 13:58
  • 1
    Thanks anyway, your comment made me think of an idea. I'm investigating right now and will report back if it works.
    – janpio
    Oct 1, 2013 at 14:12
1

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.

4
  • Thanks, Toschos examples are a good starting point. I think I'll have to understand how all this permalink stuff works, what hooks can be used etc. Maybe I can write a plugin myself to solve my problem.
    – janpio
    Oct 1, 2013 at 16:29
  • Yes, I think this is the right way, if you will not change the global structure. The problem is special, I think you don't find ready solution.
    – bueltge
    Oct 2, 2013 at 8:24
  • Yeah it is special, but I am actually convinced that it is the better solution than just update the permalinks and redirect all the old links to the new URL. And that seems to be the advice to Wordpress users, wanting to change their structure right now. So, maybe it can actually get useful for more people. If I can figure it out ;)
    – janpio
    Oct 2, 2013 at 9:08
  • 1
    Ok, your decision. If you search for help on change permalinks, my last hint to this plugin
    – bueltge
    Oct 2, 2013 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.