Fossil Forum

Aliasing /mypage to /doc/trunk/mypage.html
Login

Aliasing /mypage to /doc/trunk/mypage.html

Aliasing /mypage to /doc/trunk/mypage.html

(1) By rpdillon on 2022-01-11 19:29:47 [link] [source]

Hello! I use fossil to host parts of my website, and have a question about aliases. I have a file that I usually view in the repo at /doc/trunk/mypage.html, and I'd like to alias it to /mypage. I'm able to register it at /waliassetup with /mypage as the key and /doc/trunk/mypage.html as the value, but when I visit /mypage, I get a yellow banner that informs me that:

"/mypage" aliased to "/doc/trunk/mypage.html" but "/doc/trunk/mypage.html" does not exist

Notably, I can set the "Home" page of the repository to a /doc/trunk/ URL and it works.

So, my question: am I doing this incorrectly, or is aliasing to documentation in this manner not supported?

(2) By Stephan Beal (stephan) on 2022-01-12 00:01:15 in reply to 1 [link] [source]

So, my question: am I doing this incorrectly, or is aliasing to documentation in this manner not supported?

From the waliassetup help:

The RHS entries must be built-in webpage names.

That's unfortunate but it is a current limitation.

(3.1) By george on 2022-01-12 01:32:04 edited from 3.0 in reply to 1 [source]

It is possible to alias to the /doc/VERSION/path/to/file page. You have to specify VERSION and path/to/file using URL parameter "name", so that RHS looks like:

/doc?name=VERSION/path/to/file

A similar trick can be used for /raw pages. To serve data (e.g. javascript) from a specific (presumably trusted) check-in use "ci" parameter in RHS:

/raw?ci=VERSION

EDIT: For example, this can be used to serve MathJax from within versioned content.

P.S.
Also a stale cache of the browser may sometimes lead to a confusion...

(4) By Stephan Beal (stephan) on 2022-01-12 02:40:43 in reply to 3.1 [link] [source]

It is possible to alias to the /doc/VERSION/path/to/file page. You have to specify VERSION and path/to/file using URL parameter "name", so that RHS looks like:

Excellent :). Internally, all request paths get translated from /foo/bar/baz to /foo?name=bar/baz, so it might make sense to have the alias redirector do that automatically if the passed-in URL does not match the regex [?&]name=.

(5) By rpdillon on 2022-01-15 17:00:26 in reply to 3.1 [link] [source]

I tried this and it works perfectly for my use case. Thanks so much for telling me about this!