SID-02406: 'edit' and 'login' don't function after URL Shortening
| Status: |
Answered |
TWiki version: |
6.0.1 |
Perl version: |
5.22 |
| Category: |
CategoryInstallation |
Server OS: |
Ubuntu 16.04 |
Last update: |
6 years ago |
New question on a previous problem.
I'm attempting to follow the guide at
https://twiki.org/cgi-bin/view/TWiki.ShorterUrlCookbook to shorten the URLs our existing 6.0 TWiki installation uses.
Here's as much relevant config as I can find.
In Apache's twiki.conf:
ScriptAlias /bin "/var/www/twiki/bin"
Alias /pub "/var/www/twiki/pub"
Alias /pub/Sandbox "/var/www/twiki/pub/Sandbox"
ScriptAlias /pub "/var/www/twiki/bin/viewfile"
Alias / "/var/www/twiki/bin/view/"
In twiki/lib/LocalSite.cfg:
$TWiki::cfg{ScriptUrlPath} = '';
$TWiki::cfg{ScriptUrlPaths}{view} = '';
Under this configuration, the Main Web front page loads for
http://mywiki.org
, and most links are navigable as normal, such as
http://mywiki.org/Project1
,
http://mywiki.org/Project1
,
http://mywiki.org/Main/WebHome
,
http://mywiki.org/bin/configure
, etc.
When I try to login or to edit a page under the Project1 Web, however, the browser attempts to load
http://mywiki.org/login/Project1/
or
http://mywiki.org/edit/Project1/
, respectively, which produces an error page with the message
The "login/Project1" web does not exist
(or "edit/Project1", you get the idea). Any idea what the problem is here and what I need to change? The
ShorterURL Guide doesn't cover this that I can tell.
Thanks!
--
TWiki Guest - 2019-05-20
Discussion and Answer
Quick check: Can youi login under
http://mywiki/bin/login/Project1/
?
If so, then I guess that the problem here is a mismatch between the Apache and TWiki configurations.
In your TWiki configuration you should have, in the section "General path settings", the
{ScriptUrlPath} set to
/bin. The symptom you describe can be caused by having an empty value for that setting.
(Disclaimer: I don't use Apache any more so my knowledge is from fading memories)
--
Harald Jörg - 2019-05-21
The URL
http://mywiki/bin/login/Project1/
successfully loads the login
page, yes. If I try to login, though, the form loads
https://mywiki.org/login/Project1/WebHome
as an error page with the message
The "login/Project1" web does not exist.
I tried changing
{ScriptUrlPath} as you've suggested, but after some confusion I realized that the change isn't saving. I'm absolutely certain I'm hitting the
Save button at the end of the config process, and I get the confirmation
$TWiki::cfg{ScriptUrlPath} \ '/bin';=, but every time I return to the
configure page,
{ScriptUrlPath} has been reset to an empty value.
Have you ever seen this, or can you guess the problem?
--
TWiki Guest - 2019-05-21
This is the symptom I would expect: TWiki is basing all links on
ScriptUrlPath, including all redirections. The text of the message comes from the fact that
/ is mapped to
/bin/view, and if you have hierarchical webs, then you could have URLs like
/login/Project1. Well, actually not, because TWiki enforces web names to start with an uppercase character, but the error message doesn't know this.
I've two guesses:
- Perhaps the web server user doesn't have write permission to your
lib/LocalSite.cfg file? I've usually set it to readonly, to keep myself from shooting into my own foot
- You need to restart the web server for changes to come into effect. I don't recall whether the defaults in the configure screen are taken from the file or from the session.
In any case, you can try to edit the file by hand.
--
Harald Jörg - 2019-05-21
The non-saving config does sound like a permissions issue, but the Apache user
www-data has write access to everything in the path to
/var/www/twiki/lib/LocalSite.cfg:
<verbatim>
drwxrwx--- 14 www-data www-data twiki
drwxr-xr-x 5 www-data www-data lib
-rw-r--r-- 1 www-data www-data
LocalSite.cfg
</verbatim>
Nevertheless, I was able to edit
LocalSite.cfg successfully to set {ScriptUrlPath} equal to '/bin'. Everything works! Logins, edits, site navigation, etc. I'm going to worry about the permissions thing later.
Thanks for your help so far, Harald. I have one more question that I'll post separately.
--
TWiki Guest - 2019-05-21
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.