Base HREF is wrong when scripturls are changed
Some templates use
%SCRIPTURL%/%SCRIPTNAME%/
to construct the base URL for this page.
When one changes script-URLs (e.g., to get shorter URLs), that base URL is wrong and internal links fail.
Example case
Use a default 4.1.2 installation where URLs have been shortened according to the
TWiki:TWiki.ShorterUrlCookbook
.
Then a page will have the URL
http://wiki.domain.tld/Web/TopicName
.
But page.pattern.tmpl will add the tag
<base href="http://wiki.domain.tld/view/Web/TopicName"></base>
at the top of the page. This base href is used for topic-internal links, e.g., for the table of contents.
At best, this leads to a superfluous reload, since the internal links refer to a different URL (
/view/Web/...
) than that of the current page (
/Web/...
).
At worst, there is no RewriteRule/ScriptAlias for
/view/
defined and all links in the table of contents cannot be resolved and lead to 404 not-found errors.
Proposed Solution
Use
%SCRIPTURL{%SCRIPTNAME%}%
instead.
Every working scripturl setup has adapted $TWiki::cfg{ScriptUrlPaths}{view} or whatever script URL it changes.
Patch
I attach a patch to the 4.1.2 codebase that changes all existing base hrefs accordingly.
Remarks
I don't know if a bug in the distributed basic skins categorizes as Engine or Extension, so I leave it at Engine.
If you need an Internet-accessible 4.1.2 installation to test that bug (for some time), I can make that available.
--
TWiki:Main.JoachimSchrod
- 27 Apr 2007
See my latest comment in
TWiki:TWiki.ShorterUrlCookbook
. It might serve as a permanent solution for short urls.
--
TWiki:Main/KwangErnLiew
- 27 Apr 2007
Sorry, but AFAICS your comments are not relevant for this bug: you still keep the
/view
action prefix in your proposal, i.e., you just work without
.../bin
prefix in front of
/view
. This bug is about wrong base hrefs if you have
discarded the /view
prefix, too.
--
TWiki:Main.JoachimSchrod
- 27 Apr 2007
Thanks Joachimn, I applied your patch on MAIN branch (for 4.2)
CC