For those of you that might not know (and I was one of you about a month ago), Zeus is a Web server package that’s used instead of apache by some Web hosts. If you’re planning to use WordPress, and you have a choice between apache and Zeus, I would definitely recommend choosing apache. However, sometimes you don’t have a choice in the matter; and you have to do what you can to make things work.
WordPress will work out of the box with Zeus, but a lot of things won’t behave the way you might expect. One of those things is the permalink structure.
Instead of getting nice, clean URLs like “http://example.com/blog/2012/01/my-first-blog-post/”, you get “index.php” shoved in there (like “http://example.com/index.php/blog/2012/01/my-first-blog-post/”). You can correct this issue, but it’s not quite as simple as updating an .htaccess file (in fact, without some jiggery-pokery by your Web host, Zeus doesn’t support .htaccess at all). Instead, you have to apply a rewrite script to your server configuration.
After quite a bit of searching and trial & error, I finally found a working rewrite script configuration for WordPress. A hosting company called ZipHosting posted the scripts below in their knowledgebase. The first script is set up for you to use if WordPress is hosted in a subdirectory, and the second is for use with WordPress in the root directory.
WordPress in a Subdirectory
RULE_0_START: # Get the document root path and put value into the SCRATCH array. # This is the server path not the web URL. # i.e. /clientdata/clients/p/h/php.testing.au.com/www/ map path into SCRATCH:DOCROOT from / # Get the URL without the domain. # e.g. /test&colour=red # e.g. /an-example-post/?color=red set SCRATCH:ORIG_URL = %{URL} set SCRATCH:REQUEST_URI = %{URL} # See if there are any queries in our URL. match URL into $ with ^(.*)\?(.*)$ # If there are... if matched then # Set a var to path without the domain part. # e.g. /an-example-post set SCRATCH:REQUEST_URI = $1 # Set a var to the passed queries. # e.g. colour=red set SCRATCH:QUERY_STRING = $2 endif RULE_0_END: RULE_1_START: # This is setting a var to the server path and sub folders. # e.g. /clientdata/clients/p/h/php.testing.au.com/www/wordpress/an-example-post/ set SCRATCH:REQUEST_FILENAME = %{SCRATCH:DOCROOT} set SCRATCH:REQUEST_FILENAME . %{SCRATCH:REQUEST_URI} # Check to see if the file exists. look for file at %{SCRATCH:REQUEST_FILENAME} if not exists then # The file wasn't found so is it a folder? look for dir at %{SCRATCH:REQUEST_FILENAME} if not exists then # No folder either. So now check the URL for special hosting folders. match SCRATCH:ORIG_URL into % with ^/stats|^/logs if matched then # If a special folder was requested end the script. goto END else # There were no files, folders or special folders so set the new URL. # -- Sub directory ------------------------------------------------------------- # If the blog is in a sub directory...replace the words in bold with your directory name. # e.g. /wordpress/index.php/an-example-post match SCRATCH:REQUEST_URI into $ with ^/wordpress(.*) if matched then set URL = /wordpress/index.php$1 endif # -- Sub directory ends -------------------------------------------------------- # or... # -- Top level ----------------------------------------------------------------- # If the blog is in the top level of the site... # e.g. /index.php/an-example-post # set URL = /index.php%{SCRATCH:REQUEST_URI} # -- Top level ends ------------------------------------------------------------ # Go to the next rule. goto RULE_2_START endif endif endif # If files or folders were found end the rewrite script. goto END RULE_1_END: RULE_2_START: # Check for queries in the requested URL. match SCRATCH:ORIG_URL into % with \?(.*)$ if matched then # If queries were found add them to the new URL. # e.g. /index.php/an-example-post/&colour=red set URL = %{URL}&%{SCRATCH:QUERY_STRING} endif # -- Sub directory ------------------------------------------------------------- # If you only want to rewrite the sub directory uncomment this bit. match SCRATCH:ORIG_URL into % with ^/wordpress if matched then # -- Sub directory ends -------------------------------------------------------- # End the script. goto END # -- Sub directory ------------------------------------------------------------- endif # -- Sub directory ends -------------------------------------------------------- RULE_2_END:
WordPress Installed in the Root Directory
RULE_0_START: # Get the document root path and put value into the SCRATCH array. # This is the server path not the web URL. # i.e. /clientdata/clients/p/h/php.testing.au.com/www/ map path into SCRATCH:DOCROOT from / # Get the URL without the domain. # e.g. /test&colour=red # e.g. /an-example-post/?color=red set SCRATCH:ORIG_URL = %{URL} set SCRATCH:REQUEST_URI = %{URL} # See if there are any queries in our URL. match URL into $ with ^(.*)\?(.*)$ # If there are... if matched then # Set a var to path without the domain part. # e.g. /an-example-post set SCRATCH:REQUEST_URI = $1 # Set a var to the passed queries. # e.g. colour=red set SCRATCH:QUERY_STRING = $2 endif RULE_0_END: RULE_1_START: # This is setting a var to the server path and sub folders. # e.g. /clientdata/clients/p/h/php.testing.au.com/www/wordpress/an-example-post/ set SCRATCH:REQUEST_FILENAME = %{SCRATCH:DOCROOT} set SCRATCH:REQUEST_FILENAME . %{SCRATCH:REQUEST_URI} # Check to see if the file exists. look for file at %{SCRATCH:REQUEST_FILENAME} if not exists then # The file wasn't found so is it a folder? look for dir at %{SCRATCH:REQUEST_FILENAME} if not exists then # No folder either. So now check the URL for special hosting folders. match SCRATCH:ORIG_URL into % with ^/stats|^/logs if matched then # If a special folder was requested end the script. goto END else # There were no files, folders or special folders so set the new URL. # -- Sub directory ------------------------------------------------------------- # If the blog is in a sub directory...replace the words in bold with your directory name. # e.g. /wordpress/index.php/an-example-post # match SCRATCH:REQUEST_URI into $ with ^/wordpress(.*) # if matched then # set URL = /wordpress/index.php$1 # endif # -- Sub directory ends -------------------------------------------------------- # or... # -- Top level ----------------------------------------------------------------- # If the blog is in the top level of the site... # e.g. /index.php/an-example-post set URL = /index.php%{SCRATCH:REQUEST_URI} # -- Top level ends ------------------------------------------------------------ # Go to the next rule. goto RULE_2_START endif endif endif # If files or folders were found end the rewrite script. goto END RULE_1_END: RULE_2_START: # Check for queries in the requested URL. match SCRATCH:ORIG_URL into % with \?(.*)$ if matched then # If queries were found add them to the new URL. # e.g. /index.php/an-example-post/&colour=red set URL = %{URL}&%{SCRATCH:QUERY_STRING} endif # -- Sub directory ------------------------------------------------------------- # If you only want to rewrite the sub directory uncomment this bit. # match SCRATCH:ORIG_URL into % with ^/wordpress if matched then # -- Sub directory ends -------------------------------------------------------- # End the script. goto END # -- Sub directory ------------------------------------------------------------- endif # -- Sub directory ends -------------------------------------------------------- RULE_2_END:
Unfortunately, that won’t solve all of your permalink issues, but it will get you started. One serious issue you might encounter is the fact that query strings aren’t recognized at the end of your permalinks; instead, WordPress shows a 404 error page whenever a query string is attached. In my next article, I’ll explain how I fixed that issue.
Post Your Comment