Re: CMS page lookup (301 | 404)???
Posted: Tue Feb 03, 2009 2:13 pm
I dealt with exactly the same problem recently.
Likewise, on a small-ish CMS, and I use the term "slug" for title to link conversion.
e.g "My Page's Title" becomes the slug "my-pages-title"
These are roughly the steps I ended up taking, which might be of interest or not.
What I did was limit the title to n chars, so that the corresponding link would never be too long.
Enforced non-duplicates in the database, naturally.
On page creation, create the slug, and store in database**
So, user requests the page - then there's is the usual .htaccess rewrite and then straight to a cached array to check if the slug is good.
No prob.
But then as you say, Client decides, "My Page's Title" is now going to be "My Page's New Title".
What I do on the clients GUI is, on save, compare the slugged new title to the old slug
i.e. "my-pages-new-title" != "my-pages-title"
so I pop up a message, "Is 'my-pages-title' still fairly indicative of the content of this page?"
If the client replies "Yes" then the slug stays the same.
If "No" then they are warned that they risk losing visitors to this page, and that they should really create a new page.
I am not saying this is the cure, its just that if only a small percentage of page slugs will ever change, and if they are doing that to change the entire meaning of the page, then, really that old page should die/disappear, but even that will likely be a small percentage of that small percentage.
Sorry I am not answering your OP about 301|404 - just throwing another idea out there.
** the slug then naturally becomes an ideal candidate for being the PK of the table, a big bonus in my book
Likewise, on a small-ish CMS, and I use the term "slug" for title to link conversion.
e.g "My Page's Title" becomes the slug "my-pages-title"
These are roughly the steps I ended up taking, which might be of interest or not.
What I did was limit the title to n chars, so that the corresponding link would never be too long.
Enforced non-duplicates in the database, naturally.
On page creation, create the slug, and store in database**
So, user requests the page - then there's is the usual .htaccess rewrite and then straight to a cached array to check if the slug is good.
No prob.
But then as you say, Client decides, "My Page's Title" is now going to be "My Page's New Title".
What I do on the clients GUI is, on save, compare the slugged new title to the old slug
i.e. "my-pages-new-title" != "my-pages-title"
so I pop up a message, "Is 'my-pages-title' still fairly indicative of the content of this page?"
If the client replies "Yes" then the slug stays the same.
If "No" then they are warned that they risk losing visitors to this page, and that they should really create a new page.
I am not saying this is the cure, its just that if only a small percentage of page slugs will ever change, and if they are doing that to change the entire meaning of the page, then, really that old page should die/disappear, but even that will likely be a small percentage of that small percentage.
Sorry I am not answering your OP about 301|404 - just throwing another idea out there.
** the slug then naturally becomes an ideal candidate for being the PK of the table, a big bonus in my book