Forum

Need help with these .htaccess rules for Sendy

Gilad
15 May 2015, 09:46
Hi,
I am trying to translate the following .htaccess to Hiawtha urlkit. It's the rules for the Sendy.io mailer system.
Something is going into an infinite redirect so I'm guessing I got something wrong. Can you please help?

Original htaccess:
ErrorDocument 404 "[404 error] If you're seeing this error after install, check this FAQ for the fix: https://sendy.co/troubleshooting#404-error"

Options +FollowSymLinks
Options -Multiviews

RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9-]+)$ $1.php [L]

# Link tracker
RewriteRule ^l/([a-zA-Z0-9/]+)$ l.php?i=$1 [L]

# Open tracker
RewriteRule ^t/([a-zA-Z0-9/]+)$ t.php?i=$1 [L]

# Web version
RewriteRule ^w/([a-zA-Z0-9/]+)$ w.php?i=$1 [L]

# unsubscribe
RewriteRule ^unsubscribe/(.*)$ unsubscribe.php?i=$1 [L]

# subscribe
RewriteRule ^subscribe/(.*)$ subscribe.php?i=$1 [L]


My translated (Wrong I guess) Hiawatha set:
UrlToolkit {
ToolkitID = sendy
Match ^([a-zA-Z0-9-]+)$ Rewrite $1.php
Match ^l/([a-zA-Z0-9/]+)$ Rewrite l.php?i=$1
Match ^t/([a-zA-Z0-9/]+)$ Rewrite t.php?i=$1
Match ^w/([a-zA-Z0-9/]+)$ Rewrite w.php?i=$1
Match ^unsubscribe/(.*)$ Rewrite unsubscribe.php?i=$1
Match ^subscribe/(.*)$ Rewrite subscribe.php?i=$1
RequestURI exists Return
Match .* Rewrite /index.php
}

Can you please help me?

Thanks!
Hugo Leisink
19 May 2015, 09:03
UrlToolkit {
ToolkitID = sendy
RequestURI exists Return
Match ^/([a-zA-Z0-9-]+)$ Rewrite /$1.php
Match ^/l/([a-zA-Z0-9/]+)$ Rewrite /l.php?i=$1
Match ^/t/([a-zA-Z0-9/]+)$ Rewrite /t.php?i=$1
Match ^/w/([a-zA-Z0-9/]+)$ Rewrite /w.php?i=$1
Match ^/unsubscribe/(.*)$ Rewrite /unsubscribe.php?i=$1
Match ^/subscribe/(.*)$ Rewrite /subscribe.php?i=$1
}
Gilad
20 May 2015, 08:10
Thanks Hugo!
I've made some changes to make it work with some conditions that didn't work with your toolkit. Publishing it here in case others might need it for their Sendy setup:
UrlToolkit {
ToolkitID = sendy
RequestURI exists Return
RequestURI isfile Return
Match ^/([a-zA-Z0-9-]+)$ Rewrite /$1.php
Match ^/([a-zA-Z0-9-]+)\?(.*) Rewrite /$1.php?$2
Match ^/l/([a-zA-Z0-9/]+)$ Rewrite /l.php?i=$1
Match ^/l/([a-zA-Z0-9/]+)\?(.*) Rewrite /l.php?i=$1&$2
Match ^/t/([a-zA-Z0-9/]+)$ Rewrite /t.php?i=$1
Match ^/t/([a-zA-Z0-9/]+)\?(.*) Rewrite /t.php?i=$1&$2
Match ^/w/([a-zA-Z0-9/]+)$ Rewrite /w.php?i=$1
Match ^/w/([a-zA-Z0-9/]+)\?(.*) Rewrite /w.php?i=$1&$2
Match ^/unsubscribe/(.*)$ Rewrite /unsubscribe.php?i=$1
Match ^/subscribe/(.*)$ Rewrite /subscribe.php?i=$1
}
This topic has been closed.