Hey Frank,
Post by K. FrankPost by Rutger ter BorgHey all,
I'm running a Wt application through wthttpd. It's deployed at '/'. In
order to get clean URLs, I configured --docroot to also list the
directories of static content.
This works, Wt is deployed at '/'. All URLs are clean, except for the
one referring to the site's root. So, generated hrefs from an
InternalPath set to '/' shows up as '/?'.
domain.com/?
domain.com/about
domain.com/login
domain.com/the/rest/is/clean
We cannot reproduce the '/?' issue. Can you reproduce this misbehaviour in
a small test case?
For example, on the wt homepage, this works: the languages menu has a link
to internal path '/' for the English language.
Post by K. FrankI am still uncertain how static content, URLs, InternalPath, and
--docroot all work together.
It's confusing, for sure, but let me try to explain in summary:
1) static content are files which are offered verbatim, by a web server, to
a web browser, by translating an incoming request URL to a file on the file
system. When deploying with wthttpd, the translation is done by considering
the --docroot. The docroot is the folder which contains your static
contents, and Wt will translate an incoming request of
http://myserver.com/this/url/file.txt to a file on the system within the
docroot folder: {docroot}/this/url/file.txt
2) an application is deployed at a certain URL, e.g. the Wt homepage is
deployed at '/wt' inside http://www.webtoolkit.eu/. URLs within the '/wt'
are also handled by this application. For example
http://www.webtoolkit.eu/wt/blog is handled by this application, and the
corresponding internal path is '/blog'.
There is one particular problem which leads to 'ugly URLs', namely if you
deploy your application at '/', i.e. the root of your server. Then Wt
cannot decide which URLs should be considered a request for a static file,
or a request for an internal path inside your application. To avoid
misbehavior, Wt resolves this by using a different syntax for 'internal
paths' in this case: /?_=/internal/path instead of /internal/path, leaving
all other requests to be for static files. This can be solved by indicating
to the web server specifically which URLs should be considered as static
file request: --docroot='.;/css,/html,/resources'. With this specification,
a request for http://mywebserver.com/css will be handled as a static file
request, served from within the docroot, while any other URL not listed,
like http://mywebserver.com/some/path, will be handled by your application.
Koen