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
CMS page lookup (301 | 404)???
Moderator: General Moderators
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: CMS page lookup (301 | 404)???
I tested this in WordPress and oddly it doesn't appear to prevent overlap issues.Enforced non-duplicates in the database, naturally.
No worries any feedback is appreciated.Sorry I am not answering your OP about 301|404 - just throwing another idea out there.
Re: CMS page lookup (301 | 404)???
I pondered my reply last night, and felt that I failed to spell out the main point:
If the client feels that old slug is no longer indicative of the content, and they are going to overwrite the content, then removing the page is probably the correct thing to do ...
So there are three possibilities:
If the client feels that old slug is no longer indicative of the content, and they are going to overwrite the content, then removing the page is probably the correct thing to do ...
So there are three possibilities:
- Those that simply fiddle with the content and title, slug stays the same - no further action.
- Those that fiddle with the content and title enough to make the old slug misleading - create a new slug, what to do with the old one?
- Those that use the edit function of the cms to effectively delete one page and replace it with new content - they are using the wrong functionality
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: CMS page lookup (301 | 404)???
Updating the slug would mean 301 redirect...Those that fiddle with the content and title enough to make the old slug misleading - create a new slug, what to do with the old one?
Re: CMS page lookup (301 | 404)???
I wonder how you advocate managing these (infrequent) 301 redirects.
Say the CMS was multi-domain, it would likely mean adding a line to a .htaccess file in the top directory.
But if that directory already had some local rules in it, is there another place/means that the domain specific .htaccess file can pull in these 301 instructions I wonder?
Say the CMS was multi-domain, it would likely mean adding a line to a .htaccess file in the top directory.
But if that directory already had some local rules in it, is there another place/means that the domain specific .htaccess file can pull in these 301 instructions I wonder?
- allspiritseve
- DevNet Resident
- Posts: 1174
- Joined: Thu Mar 06, 2008 8:23 am
- Location: Ann Arbor, MI (USA)
Re: CMS page lookup (301 | 404)???
You don't need .htaccess to send a 301 redirect: http://us.php.net/headerYossarian wrote:I wonder how you advocate managing these (infrequent) 301 redirects.
Say the CMS was multi-domain, it would likely mean adding a line to a .htaccess file in the top directory.
But if that directory already had some local rules in it, is there another place/means that the domain specific .htaccess file can pull in these 301 instructions I wonder?