Joomla SEF and Zeus Rewrite

f you are looking at this page the chances are that you have installed Joomla on your hosting, though discovered that rather than running Apache and mod_rewrite they are running Zeus which uses Zeus Rewrites instead. Below is the code you need to put in to a file called rewrite.script and to upload in to the root web folder of your hosting containing the site.

RULE_0_START:
# get the document root
map path into SCRATCH:DOCROOT from /
# initialize our variables
set SCRATCH:ORIG_URL = %{URL}
set SCRATCH:REQUEST_URI = %{URL}

# see if theres any queries in our URL
match URL into $ with ^(.*)\?(.*)$
if matched then
set SCRATCH:REQUEST_URI = $1
set SCRATCH:QUERY_STRING = $2
endif
RULE_0_END:

RULE_1_START:
# prepare to search for file, rewrite if its not found
set SCRATCH:REQUEST_FILENAME = %{SCRATCH:DOCROOT}
set SCRATCH:REQUEST_FILENAME . %{SCRATCH:REQUEST_URI}

# check to see if the file requested is an actual file or
# a directory with possibly an index. don’t rewrite if so
look for file at %{SCRATCH:REQUEST_FILENAME}
if not exists then
look for dir at %{SCRATCH:REQUEST_FILENAME}
if not exists then
set URL = /index.php?q=%{SCRATCH:REQUEST_URI}
goto QSA_RULE_START
endif
endif

# if we made it here then its a file or dir and no rewrite
goto END
RULE_1_END:

QSA_RULE_START:
# append the query string if there was one originally
# the same as [QSA,L] for apache
match SCRATCH:ORIG_URL into % with \?(.*)$
if matched then
set URL = %{URL}&%{SCRATCH:QUERY_STRING}
endif
goto END
QSA_RULE_END:

Once you have done this all you need to do is enable the Search Engine Friendly URLs within the Joomla Global Configuration. If you have installed Joomla in a subfolder simply alter the line

“set URL = /index.php?q=%{SCRATCH:REQUEST_URI}”

to

“set URL = /FOLDER-NAME/index.php?q=%{SCRATCH:REQUEST_URI}”

.
If you don’t want to go through the steps to try and get the rewrites working, or if your site uses features which are not supported by Zeus rewrites then you could move your site to a hosting company which has mod_rewrite. Fyrewire now offer combined hosting and site move service, so they move your site to their Apache servers which support mod_rewrite. To see the packages which support this click here.

You may also like...

1 Response

  1. Oliver says:

    Thank you so much for posting this code…..you have gotten me out of a real mess…..thank you thank you

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.