Skip to content

Instantly share code, notes, and snippets.

@ericmann
Created May 24, 2012 21:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericmann/2784237 to your computer and use it in GitHub Desktop.
Save ericmann/2784237 to your computer and use it in GitHub Desktop.
Consolidating my Websites

When WordPress first rolled in multisite features, I was thrilled. I immediately activated them and merged the two sites I already had - my personal portfolio and my business blog. At the time, I also had to have a "parent network" site ... so it really became three sites:

  • eamann.com (my primary domain and network parent)
  • work.eamann.com (my portfolio)
  • mindsharestrategy.com (mapped domain for my business blog)

Over time, my business blog evolved to contain a whole slew of other content - articles on faith, the outdoors, creative writing, etc. I added a couple of new mapped domains to my network and branched the content out to keep things separate:

  • prosepainting.com (creative writing)
  • groundedchristianity.com (faith essays)

For a time, I experimented with a few tools to syndicate content from one site to another. One post I'd write on Mindshare (business) would also apply to Grounded (faith) and I'd want it in both places. Obviously, that was a poorly set up system.

I now want to reign things in a bit and re-merge my sites. My ideal scenario would be:

  • One WordPress installation, accessible at eamann.com
  • Portfolio pieces contained in a CPT, browsable from the main site
  • Separate categories for content - eamann.com/business, eamann.com/tech, eamann.com/faith, etc ...
  • Separate themes or templates for categories - I plan to keep the same layout for everything, but want to vary the color scheme or banner images slightly for different categories

The trick now is to prevent losing legacy content. I have a few articles that bring in tons of traffic, and I don't want that to fall into the abyss.

Hopefully, things like http://mindsharestrategy.com/2011/how-to-publish-a-wordpress-plugin-subversion/ would redirect to http://eamann.com/tech/how-to-publish-a-wordpress-plugin-subversion automatically. I'd also like to display a banner for visitors being forwarded from the old URL to the new URL to explain a little why things are different.

Unfortunately, manually creating 302 redirects for 5 years of content on a mapped domain is ... not going to be fun.

Is there an easier way?

@Ipstenu
Copy link

Ipstenu commented May 24, 2012

I take it pattern recognition/regexp wouldn't work?

check if it's form groundedchristianity.com
Redirect .(*) to eamann.com/faith/$1

@ericmann
Copy link
Author

I could give that pattern recognition a try. Things are just trickier for me since I'm using Nginx instead of Apache (so my typical .htaccess tricks don't quite work).

@trepmal
Copy link

trepmal commented May 24, 2012

Just thinking out loud here...

I'm seeing the need for some sort of custom inter-network importer that will update the old/original post with the location of the new post (as a custom field) once it has been imported.
And a companion plugin that will handle the redirects for the old blog based on the custom field.

@ericmann
Copy link
Author

@trepmal As cool as that would be ... I've put this project off for long enough as it is :-) Having the redirect happen on the server (pre-WordPress) would probably be more efficient. It's just a matter of automating the redirects and maintaining some kind of request header value so I can show a "Don't freak out, but I changed the site" message.

@trepmal
Copy link

trepmal commented May 24, 2012

Oh sure, do it the easy way :)

@Rarst
Copy link

Rarst commented May 24, 2012

While this probably calls for some web server rewrite wizardry it's just might be easier to handle in WP (since this will only need to work for a while and 301 redirects will make more sense btw).

In template_redirect of "old" site make note of slug, switch to "main" site, check if post with such slug exists, retrieve its permalink and redirect to it. Shouldn't be hard to generate info page at this stage either.

@ericmann
Copy link
Author

@Rarst Except ... the new site won't be part of the same multisite network. My plan is to start with a fresh install and import/recategorize my content. So switching from one site to the other within WP won't really work.

@Rarst
Copy link

Rarst commented May 24, 2012

@ericmann even if it's not part of network it should be easy enough to fetch info from database if it's nearby... Anyway just pitched one of the ways to do it. There are many approaches to stuff like this and somehow it tends to fall into "htaccess or nothing" line of thought.

@ericmann
Copy link
Author

One way would be to leave the Multisite install going, and just have it forward the traffic to the new location ... Saves on server config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment