Content last modified Friday 19 September 2014
hop to #bottom
Categories:
Author:
Current version:
0.1.8.4
About It:
Get it:
Rate it:
  • Helpful?
  • 1 Yes
  • 0 No
Flag it:
Contact Reason [ ? ]

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.

Article Request Count:
Initially released:
2004-03-23
Posted here:
14 Mar 2005
Article modified:
30 Aug 2012

You may want to leave your comments/questions at the Forum thread for quicker feedback. Otherwise, comment away:

Commenting is closed for this article.

Commented (7)

This is a great plugin!

Together with zem_rewrite it makes possible the kind of URLs that everyone loves: simple, straightforward, without IDs. Thanks.
Lance:
the problem with this.. is if you have any links with capitals, google MAY crawl the page with a capital in the url.. any keywords with ANY capital letters will not be taken into account in a search. Though not extremely significant in determining your placement, it could mean a couple places.. and everything counts.
Thanks a lot! I had problems with the clean url mode. This plugin helps me a lot!
Phlip:
I get this error after installing and turning on this plugin when viewing my site…

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
@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?

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.