We encountered a problem for the first time ever today and that was that a client wished to host their website with Register365.

Well that wasn’t really the problem, the problem was that the site was built in Typo3 and that Register365 doesn’t support the Apache mod_rewrite rules on their server because they use Zeus Web Server.

In effect, all the lovely mod_rewrite rules we use for making those lovely search engine friendly URLs on Typo3, no longer worked… bummer…

Luckily enough, the basics of Zeus Rewrite scripts are pretty straight forward, albeit daunting when you first encounter them. Register365 give a great example of how to convert a basic mod_rewrite rule to a Zeus Rewrite rule, this is what it looks like:

Mod Rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^[^/]*\.html$ index.phpWould convert to:

Converts to:

Zeus Rewrite Rule
match URL into $ with ^/[^/]*\.html$
if matched then set URL = /index.php

Pretty cool and simple we thought – but unfortunately when you try and strive to look for the best way of doing things, this was a little too basic for our requirements. This would have worked perfectly if we used the standard simulation of static documents within Typo3, but we much prefer the RealURL’s extension as it does a great job of handling the news plugin aswell as many others. So we had to go an extra step further to make it work for us.

RULE_0_START:
map path into SCRATCH:DOCROOT from /

set SCRATCH:ORIG_URL = %{URL}
set SCRATCH:REQUEST_URI = %{URL}

# We need to check for any additional requests in the querystring

match URL into $ with ^(.*)\?(.*)$
if matched then
set SCRATCH:REQUEST_URI = $1
set SCRATCH:QUERY_STRING = $2
endif
RULE_0_END:

RULE_1_START:
set SCRATCH:REQUEST_FILENAME = %{SCRATCH:DOCROOT}
set SCRATCH:REQUEST_FILENAME . %{SCRATCH:REQUEST_URI}

# RealURLs rewrites everything, but we don’t want it to do this for images, css, etc.
# So we must check that the requested URL are not to actual files, if they are, do not rewrite.
look for file at %{SCRATCH:REQUEST_FILENAME}
if not exists then
look for dir at %{SCRATCH:REQUEST_FILENAME}
if not exists then
goto QSA_RULE_START
endif
endif

goto END
RULE_1_END:

QSA_RULE_START:
# If there was a query string, we need to append it so it knows what to do.
# the same as [QSA,L] for apache mod_rewrite
match SCRATCH:ORIG_URL into % with \?(.*)$
if matched then
set URL = %{URL}&%{SCRATCH:QUERY_STRING}
endif
goto END
QSA_RULE_END:

Don’t forget you’ll most likely have to add this through your hosting control panel. G’luck!

Tags: , , , , , , , , , ,