Project

General

Profile

Getting "clean urls" working

Added by Anon Anon over 10 years ago

While following the examples here: http://www.webtoolkit.eu/widgets/navigation/ I seem to end up with "?_=" added to my internal paths, even though the examples themselves do not have this issue. Specifically, I have this:

menu->addItem("Page")->setLink(Wt::WLink(Wt::WLink::InternalPath, "/page"));

When I select the menu item, the URL in the browser is updated to "http://localhost/?_=/page", although I would like it to instead be "http://localhost/page".

I notice when my application starts up, I get this warning:

[warening] "WApplication: Deploy-path ends with '/', using /?_= for internal paths"

So I have tried tweaking the ---deploy-path startup command argument. I notice that if I set it to, for instance, ---deploy-path=/test then things work as expected, except with the addition of "/test" in the URLs. I.e. my menu link now takes me to "http:://localhost/test/page".

Is there any way I can configure things such that the URLs neither begin with "/test" nor "/?_="?

Thanks.


Replies (1)

RE: Getting "clean urls" working - Added by Wim Dumon over 10 years ago

If you want to deploy on /, and have clear URLs with the built-in httpd, the trick is to enumerate all paths that are containing files to be served in the docroot parameter when you start your application:

--docroot .;resources

For more information, see http://www.webtoolkit.eu/wt/doc/reference/html/overview.html#wthttpd

Wim.

    (1-1/1)