Content last modified Monday 6 March 2017
hop to #bottom
Categories:
Author:
Current version:
0.5
About It:
Get it:
Rate it:
  • Helpful?
  • 0 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

zem_redirect

301 redirect and 404 not found handler for Textpattern articles. Redirects browsers and search engine spiders to the correct article URL after a title or section change, and displays a 404 response for articles that don’t exist.

Textpattern articles are currently reachable via several different URL paths. For example:

http://example.com/article/5/ http://example.com/article/5/article-title http://example.com/article/5/old-article-title-before-i-renamed-it-to-something-shorter

External factors can multiply these (e.g. www.example.com vs. example.com).

This can cause problems with search engines and link aggregators, since they don’t have any way of knowing that all of these URLs represent the same page (as opposed to multiple pages with identical content).

txp:zem_redirect is designed to help reduce the problem a bit. It checks the URL used to fetch each article; if it doesn’t match the correct URL for the article (including the article-title and full hostname as specified in the Textpattern config), it’ll return a 301 Moved Permanently response to direct the user’s browser to the correct URL. It also works as a 404 handler for articles that don’t exist or are not visible.

Just plonk the tag at the top of your article page, and it’ll do the rest. It must be the very first tag on the page, before the doctype. It has no effect in messy URL mode, or on pages other than individual articles.

warning – if you’re already using URL rewriting or other clever redirection, there’s a chance this could cause circular redirects. Test carefully, and don’t say I didn’t warn ye.

Article Request Count:
Initially released:
2004-07-09
Posted here:
25 Nov 2004
Article modified:
02 Nov 2006

If there is a comment form at the Information URL, you may want to leave your comments/questions there or at the Forum thread for quicker feedback. Otherwise, comment away:

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Commented (2)

The file’s gone walkies…

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
Published with Textpattern