Forum

Converting Apache Rewrites to UrlToolkit

Adam
22 September 2012, 21:52
Hey,
I'm trying to run the MFYU Password Generator from here: https://github.com/Brunty/MFYU_Password_Generator ...unfortunately, it has an .htaccess file with some rewrites:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>

I tried adding the following to Hiawatha:

UrlToolkit {
ToolkitID = mfyu
Match ^$ Rewrite /public/ Return
Match (.*) Rewrite /public/$1 Return
}

...but it doesn't seem to be working. I know this has been covered many times, but I've been fighting with this for hours. What am I doing wrong?

Hiawatha version: 8.5
Operating System: Ubuntu LTS
Hugo Leisink
22 September 2012, 22:02
What you better can do is point the WebsiteRoot to the public directory and use this UrlToolkit rule:
RequestURI exists Return
Match (.*)\?(.*) Rewrite $1&$2 Continue
Match ^/(.*) Rewrite /index.php?url=$1
Adam
22 September 2012, 23:00
Thanks Hugo, I'll try it out right away.
Adam
23 September 2012, 01:14
Dude, genius. It's working great. I've also pushed this info to the developer, he'll include it in the README with the next release.

Thanks again!
Adam
Chris Wadge
27 September 2012, 03:36
FYI, I've worked with Matt on this, and the project is now called "Gen&Send": https://github.com/Brunty/Gen-Send I'm actually running the official site for this, https://gensend.com ...which, I might add, is running Hiawatha. This webserver is perfectly suited to tools like this And yep, Hugo's UrlToolkit works perfectly:
UrlToolkit {
ToolkitID = gensend
RequestURI exists Return
Match (.*)\?(.*) Rewrite $1&$2 Continue
Match ^/(.*) Rewrite /index.php?url=$1
}
Adam
29 September 2012, 05:15
Dude, this is really sweet. It even has a signed cert (I'm too poor for one, hehe). I'm turning my site into a redirect to gensend.com. BTW, thanks again for the help, Hugo.
This topic has been closed.