create new tag
, view all tags

Feature Proposal: Rename a twiki page without breaking links to the old name


Currently if you rename a page from A to B, then all inbound links to http://mysite/twiki/bin/view/A get broken. 'This topic does not exist yet'. Yes, Twiki does try to update links in other wiki pages, but the world wide web is more than just one Twiki installation, and it's not polite to break incoming links and bookmarks.


When a page A has been renamed to B, going to the old URI for A shouldn't say 'this topic does not exist' but it should give some redirection page pointing to B. IMHO, the nicest way of doing this is with an HTTP Moved Permanently response.

The fastest, and in a sense cleanest, way of doing this is to write a .htaccess file for Apache with lots of 'redirectmatch' or similar directives so that the redirections are generated by the web server. But for all but very high-traffic sites it'd be simpler for Twiki to write a stub file A.has_been_renamed_to.B at the same time it moves A.txt to B.txt - and then check for the existence of this file on page views. Obviously if topic A is later recreated the redirection would stop.

-- EdAvis - 25 Dec 2005

Impact and Available Solutions

Note: Patch is attached as http://www.twiki.org/p/pub/Codev/RenamingWithoutBreakingOldLinks/twiki-foo-bar-patch.diff. The patch is against the TWikiAlphaRelease of 15 Feb 2004.


If necessary, user documentation of new features introduced by this proposal.


Example uses of features introduced by proposal.


Any comments on how the feature is implemented or could be improved


If you agree that this is a desirable feature, and the suggested implementation is reasonable, then I should be able to start hacking on it and send a patch.

-- EdAvis - 25 Dec 2005

Apologies, looks like I logged this twice. Please see RedirectToRenamedPage.

-- EdAvis - 25 Dec 2005

No I don't think this is a desireable feature.
You have failed to consider why someone would rename a topic.

Consider: I have writen a topic A and decide that while A is a reasonable name for a topic the present content would better be named B and some other content, presently named C should be named A. So I make the moves and have

  • Content(A) => Content(B)
  • Content(C) => Content(A)

but with your changes:

  • If I try to view C (which name is no longer valid and whose contet has been moved to C) I will get B
  • If I try to use the external like to A I will get B even though A has meaningful content and probably the content I want.

Why does this happen? Because the redirect is being done at the Apache level. Since the apache configuration does (or at least should) hide the .htaccess file from being viewed by the browser this is going to induce a lot of confusion. In fact even for wiki administrators who have shell access and can see that A has th content they expect but fails to display it may be confusing because they don't know that the apache redirect has been created. Not all wiki admins are Apache Gurus.

You have just violated the KISS principle.

See also the caveat at the RedirectPlugin. Only this is worse. Manually constructing a URL to edit A won't help in the least.

-- AntonAylward - 25 Dec 2005

Wouldn't it be better to introduce a second kind of topic name? Shouldn't there be an unique system generated internal name thus that our topic name becomes just another attribute of the virtual topic object? Wouldn't that allow the system to provide a list of several topics having the same virtual topic name? Renaming a topic wouldn't be a problem anymore and we would get the possibility to publish the internal names as externally bookmarkable URLs. -- Just an idea.

-- FranzJosefSilli - 26 Dec 2005

Ed, Things aren't so bad now as when you first raised the issue in RedirectToRenamedPage. If you look at WebTopicViewTemplate and WebTopicNonWikiTemplate you will see that they contain the following:

%SEARCH{ "META.TOPICMOVED.*from\=.*%WEB%.%TOPIC%.*" nosearch="on" nototal="on" regex="on" format="   * $percntRED%This topic has moved to [[$web.$topic]]$percntENDCOLOR%" }%
So now if you go to the URL for a topic that has been moved you will see a prominent link to the new topic. There are some issues it doesn't deal like topics renamed more than once, or topics moved to other webs (the search took too long on TWiki.org), but it deals with most cases.

-- SamHasler - 03 Jan 2006

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2006-01-03 - SamHasler
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.