Retaining older URLs without generating 404s

Talk about new features for CMSMS and modules.
Post Reply
wiseleo

Retaining older URLs without generating 404s

Post by wiseleo »

This feature will help those who later reorganize their sites as they grow.

With hirerarchical URLs enabled, attempting to access the old pagealiases once they moved to a different location within the menu structure.

For example:

url.com/pagealias.html is now url.com/about/pagealias.html

I would propose intercepting the now invalid url.com/pagealias.html request and redirecting the user to url.com/about/pagealias.html with a 301 code rather than generating 404s and stranding them. Additionally, the default 404 page should be coded with a {sitemap} code by default.

In ideal case, CMS would remember changes to the value of pagealias as well.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm
Location: Fairless Hills, Pa USA

Re: Retaining older URLs without generating 404s

Post by Ted »

In theory, this shouldn't happen.  The url parser is supposed to be tossing away everything except for what's after the last slash.  Since page aliases still can't be reused even if they have different parents, I don't do any magic to read the whole url.

I'm kind of surprised that you're getting a 404, to be honest.
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am
Location: Deatsville, AL

Re: Retaining older URLs without generating 404s

Post by Elijah Lofgren »

One solution would be to set this in config.php:

Code: Select all

#If you're using the internal pretty url mechanism or mod_rewrite, would you like to
#show urls in their hierarchy?  (ex. http://www.mysite.com/parent/parent/childpage)
$config['use_hierarchy'] = false;
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
Post Reply

Return to “Feature ideas”