Search code examples
phpblogspermalinks

Platform-independent permalinks - best practices?


I'm trying to figure out a generic permalinks structure for blogging, in order to be platform-independent. I know that Wordpress supports permalinks, and has some plugins for various permalinks style migration, but I also have to get it working in FlatPress and PivotX, and I don't have URL rewriting support in every place.

So far, I will try to use a folder like /permalinks/ into which an index.php file would redirect to the actual post, e.g. /permalinks/index.php?external-link-01 would redirect to /index.php/2009-02-03/external-link-01 or /index.php/e=42, based on the actual blogging platform being used.

For nicer permalinks, and to avoid URL rewriting, I could create a subfolder for each permalink (like /permalinks/external-link-01/), in which the default index file would do the redirection.

So,

  1. Is there a nicer way to maintain this kind of permalinks?
  2. What kind of redirect must I use?
  3. What can I do in order to allow bookmarking the permalink after the redirect? (e.g. the current page is /index.php/e=42 and the bookmark should be /permalinks/index.php?external-link-01)

Solution

  • Why would want to create a bunch of folders with index files in them? That seems like it would become a real nightmare to manage in the longer term. Why do you want to avoid URL rewriting? Mod_rewrite seems like a clean and centralized and ultimately flexible system that will be easier to manage in the long term.

    Not criticizing, just curious to understand the motivation of your project.

    As for redirect I think you want do a

    301 moved permanently

    That way the redirect is understood correctly by the search engines. And you won't have errant urls lost in SEO land if your permalink system goes down.

    You might also consider throwing in a URL shortening scheme in your system as well.

    http://www.shauninman.com/archive/2009/08/17/less_n

    And if you have a system with multiple references to different URLs but the same content be sure not to forget about Canonical Links.

    http://www.mattcutts.com/blog/canonical-link-tag/