dokuwiki-plugin-move icon indicating copy to clipboard operation
dokuwiki-plugin-move copied to clipboard

[feature request] automatic redirection

Open trebmuh opened this issue 9 years ago • 12 comments

Hi.

I've been thinking of this feature a few times so, it needs to be shared here.

When moving a page (or a few pages), it would be really handy that the plugin adds an automatic redirection (into the .htaccess maybe?).

Hope that this will retain your attention.

trebmuh avatar Mar 24 '16 14:03 trebmuh

I wonder if this could be added as a plugin to the plugin.

splitbrain avatar Mar 29 '17 14:03 splitbrain

I would also be interested in this feature. A significant portion of the content on the wiki I administer is added by users who are migrating it from other deprecated sources (e.g. an old intranet page); however, the namespace /pagename chosen by users does not always match the wiki guidelines, so I move pages fairly often, but then I have to manually ensure that users who have bookmarked the URL of the original non-wiki page (where the content was migrated from) will not get lost when landing on the wiki.

I love the idea of an optional "This page has moved to <new URL>" and/or an automatic redirect. However, I'm not sure I like the idea of .htaccess modification:

  • Programmatic modification of .htaccess would have to do a very good job of understanding how .htaccess works, or it might break some people's [custom] .htaccess some of the time.
  • After lots of moves, either the root .htaccess would get very complex, or there would be lots of individual .htaccess - all different from one another - scattered through subdirectories. I think this could be hard to debug for a wiki admin without CLI access.
  • Seems like using a sledgehammer to crack a nut.

An alternative: PHP could return a 301 Permanently Moved redirect. I've used MediaWiki a bit - in fact, I tried MediaWiki before abandoning it for Dokuwiki - and the way MediaWiki handles this scenario seems to me to work well.

FosseWay avatar Jun 05 '17 15:06 FosseWay

It should only be an Option IMHO, otherwise it will clutter htaccess

rgleason avatar Jun 09 '17 12:06 rgleason

A follow-up of "also insterested"/"also hope to see this feature".

I think the MediaWiki way of moving+redirecting is feasible.

GJRobert avatar Jun 06 '18 04:06 GJRobert

I am also interested in this feature.

cknoll avatar Feb 16 '19 16:02 cknoll

There is the redirect plugin. Could we not have move hook into that? https://www.dokuwiki.org/plugin:redirect

yareckon avatar Oct 05 '20 09:10 yareckon

There is the redirect plugin. Could we not have move hook into that? https://www.dokuwiki.org/plugin:redirect

A "redirect table" has to be manually built and maintained, to let DokuWiki know the rules of redirection. This is how plugin:redirect works.

It may be great if the rules are recorded at the same time when pages are moved by plugin:move...

GJRobert avatar Oct 05 '20 10:10 GJRobert

OK, just read the code of the redirect plugin, and it does not have a api at all to add a redirect. It just loads or saves the whole redirects file as a blob. So a proper first step might be to add the feature to that plugin to be able to add redirects line by line. Otherwise, we could just try to append a line to DOKU_CONF . '/redirect.conf';

yareckon avatar Oct 05 '20 10:10 yareckon

Thanks for bringing this up!

I was looking for automatic redirects, too, so that old URLs keep working when we change our wiki structure.

Adding a line to the redirect.conf file for now seems like a good solution indeed.

stapelberg avatar Oct 11 '20 08:10 stapelberg

As a workaround, I just re-create the moved page and add a link to the new location. Would sure be great if this feature was implemented though. Seems there are already some ideas on how to do this posted here. 😓

Chiramisudo avatar Jan 27 '23 21:01 Chiramisudo

For those of us who use the Redirect plugin, a simple #REDIRECT {newpagename} would do...

saschaleib avatar Apr 20 '23 17:04 saschaleib

For those of us who use the Redirect plugin, a simple #REDIRECT {newpagename} would do...

@saschaleib Thanks for sharing this info. For this inline usage/syntax, it's plugin:pageredirect [DokuWiki] to be used.

And there is plugin:redirect [DokuWiki], with which we have to write the redirect pairs in a centralized file, so it was not as convenient.

GJRobert avatar Apr 21 '23 10:04 GJRobert