WordPress and Zeus Rewrite

If you are looking at this page the chances are that you having hosting with a company running Zeus web servers and you are trying to run WordPress with its Permalinks. As you have probably discovered mod_rewrite is not supported by Zeus, however it has its own rewrite language called Zeus Rewrite. Well you’re in luck, 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:

You will now hopefully have working permalinks in WordPress! Though it doesn’t stop there, you may notice that you have index.php at the start of all your addresses? Well have a solution for that too. Go to the WordPress settings > Permalinks and tell it to do a custom structure permalink:

/%category%/%postname%/

That’s all there it to it! This may not work for every hosting company running Zeus on their servers, however have heard of it working with a number of different hosting companies. If you have installed WordPress in a subfolder you may need to 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...

7 Responses

  1. Dan says:

    Thanks a lot, guy!
    I was looking for this solution for weeks. This article was the only one telling about the custom folder name.

    Many thanks!

  2. Tracey says:

    Thanks for this article Adam – it’s the first time I’m setting up a client site on Zeus hosting & this has resolved the “index.php” problem.

    (Note : as I already had set the permalinks before reading this article, I had to go back & edit them to also remove the “index.php” prefix there, after adding the rewrite.script file. )

    thanks!
    Tracey

  3. Jamie says:

    Thanks alot for this , saved me a lot of frustration

  4. Steve says:

    Thank you for this, you have saved me a lot of head scratching. Much appreciated!! Steve.

  5. Steve says:

    Hi there, thanks for this. Worked a treat on single site. However, have you done this for Multisite for domain mapped installations?

  6. LuRcH says:

    Hi,

    I’ve not done this for a Multisite setup unfortunately.

  7. Gavin Wilshen says:

    More thanks for the top work, unparalleled by lazy web-hosting companies who ‘don’t support 3rd party apps’. Regards!

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.