Search code examples
regexhiawatha

How to convert URL rewrite from Apache to Hiawatha


I'm using the Hiawatha webserver and need to convert the following Apache URL rewrite rule into a URL toolkit rule.

RewriteRule ^symphony\/api(\/(.*\/?))?$ extensions/rest_api/handler.php?url=$1&%{QUERY_STRING} [NC,L]

%{QUERY_STRING} can't be used in Hiawatha's URL toolkit.

I've tried a few things, but my regex is poor.

Here's the basic Hiawatha URL rewrite format:

Match <originalurl> Rewrite <rewrittenurl>

An example URL that needs to be rewritten:

http://domain.co.uk/symphony/api/entries/photos/?auth-token=019ccc6e

Thanks.


Solution

  • Just a guess, try

    Match ^symphony\/api(\/(.*\/?))?\?(.*)$ Rewrite extensions/rest_api/handler.php?url=$1&$2
    Match ^symphony\/api(\/(.*\/?))?$ Rewrite extensions/rest_api/handler.php?url=$1