Forum

Configuring rewriterules

sauen
16 July 2012, 16:20
Hiawatha version: latest for win
Operating System: win7

I have different folders inside the wwwroot and I am used to being able to set rewriterules in the .htaccess file,
now I have successfully managed to create a .hiawatha file in one of the folders and put in it a custom StartFile
like StartFile = hello.html

I started trying to put in rewriterules, after looking at examples on this forum and the faq etc, so I tried putting the
rewriterules in the .hiawatha file, but then I just got errors, the error.log says the syntax is wrong in the line where it starts..

So the only way I managed to make it work is if I set a virtual host and a urltoolkit with rewrite, in the hiawatha.conf file.

So is this correct, that rewrites cannot be done per folder, and for every time I want to change a rule, I have to restart the server?

Please tell me it is possible to make custom rewrites per folder, like in the .hiawatha file, without restarting the server
I really hope I just got something wrong, and that it should work if done correctly
Ali
16 July 2012, 21:48
According to the User Settings Per Directory [hiawatha-webserver.org] section of the Hiawatha Manual, .hiawatha files does not support url rewriting information. I believe, as you have already noticed, that leaves UrlToolkit plus VirtualHost configuration as the only solution.

But, don't take my word for it, I'm also new to Hiawatha
Hugo Leisink
16 July 2012, 22:49
Ali is right, UrlToolkit rules don't go in a .hiawatha file. So, yes, you have to place them in the hiawatha.conf file and restart the webserver to use them.
Rewrite cannot be done per directory, but you can place the directory in the regex pattern.
sauen
18 July 2012, 12:57
Ok, thanks a lot for answering It was not the answer I was hoping for, but now it is confirmed.

I still think hiawatha is great, and maybe in future versions, there could be a possibillity to have rewrite rules
in the .hiawatha file. That would make it easier for those who are used to how it is done in the .htaccess,
and it would require less frequent server restarts.

Or maybe there is some security reason for it not being possible?
Anyways, I love hiawatha server, and I hope it will continue being developed
Hugo Leisink
20 July 2012, 09:45
No security reasons. It's just that placing UrlToolkit rules in .hiawatha files conflicts a bit with how Hiawatha was build and requires some ugly hacks to make it work.
This topic has been closed.