sgb_url_handler
I’ve posted elsewhere about making modifications to TxP in order to support all URL formats at the same time. Rather than make the modifications directly to TxP I rolled them into a plugin.
This plugin was designed and tested with TxP 1.0 RC3 (updated from subversion on 2005-03-05).
Now for some background. I love the fact Dean & Co. add so many URL options to TxP. However only supporting one type of incoming link at a time seems like an oversight to me. While links on your own site might not break when you change modes, links off-site (such as links posted in forums or wikis) will. This plugin allows you to change your URL mode at will while still supporting any/all URL formats.
Currently it supports the following formats:
example.com/section/id/title
example.com/section/title
example.com/section/category/title
example.com/section/category
example.com/section
example.com/title
example.com/id/title
example.com/year/month/day/title (although this appears to be broken in RC3)
Additionally, this plugin supports the following trigger words:
example.com/{section}/Section
example.com/{category}/Category
example.com/{author}/Author
example.com/atom
example.com/rss
The plugin supports all these modes with or without a trailing slash. In the event of collisions, the plugin will check the more general term first, e.g. /Section will be checked before /Title.
Also note that this plugin is designed to work with clean URLs on servers without mod_rewrite. You’ll need to modify your links and append index.php/ to the beginning, e.g. example.com/index.php/section/id/title is the same as example.com/section/id/title.
The plugin “pipes” /Section, /Category and /Author requests to the corresponding $_GET, $_POST super globals so they are handled normally by TxP.
If the plugin can’t figure something out it just returns and let’s TxP handle it normally.
I’ve written instructions for adding permlink modes for /Section/Title and /Section/Category/Title. These instructions can be found here.









You may want to leave your comments/questions at the Forum thread for quicker feedback. Otherwise, comment away:
Commented (7)
Together with zem_rewrite it makes possible the kind of URLs that everyone loves: simple, straightforward, without IDs. Thanks.
A problem occured while loading the plugin: sgb_url_handler -> User_Warning: Unable to include plugin “sgb_error_documents” on line 399
any help here? I’m trying to solve a problem with needing a trailing slash on all urls in my site. thanks
Phlip
Visit this page:
http://textpattern.org/plugins/210/sgberrordocuments
Enjoy ;)
Any chance of this working on 4.2.0? Same as Philip, I’m trying to get a trailing slash on my links.
Any chance of this working on 4.2.0? Same as Philip, I’m trying to get a trailing slash on my links.
Subscribe to this article's comments RSS feed. [ ? ] View Recent Comments across the site.
Would you care to write a comment or visit the forum discussion?