WordPress Permalinks on a Namesco Zeus Server
Monday, 1st March 2010I had a bit of a problem recently trying to convert a WordPress .htaccess file to a rewrite.script file for a Zeus server. My knowledge of the syntax for rewrite.script was non-existant so I tried the .htaccess converter provided in the Namesco admin.
This managed to get me part of the way there but the permalinks included “index.php” before the custom permalink setting.
Hunting around I found this blog post by Adam Christie in which he documents a rewrite.script for WordPress – and it works! I have provide the code below for your reference.
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:


July 9th, 2010 at 10:17 am
Cheers, life saver!
July 30th, 2010 at 11:44 pm
Much appreciated, just what I was after!
August 3rd, 2010 at 8:54 pm
Ben, tried your script on Zeus as opereated by Namesco (UK ISP)…. thanks but no success. See this forum post / wondering if a plugin is possible ? interested ?
http://wordpress.org/support/topic/zeus-server-rewrite-script-for-wordpress?replies=2
phil
August 4th, 2010 at 8:39 pm
Phil, a plugin sounds like an interesting idea…
I don’t get why this rewrite thing seems to work for some people and not others. Is your WordPress install in a subdirectory or anything? Is it just the standard WordPress install setup?
August 11th, 2010 at 1:34 pm
Hi Ben, you are a superstar.
I’m on Zeus via Namesco and didn’t get anything back from their support team.
I’ve implemented your fix and it works a treat!
Many thanks and hope you have a fine day, cos you deserve it!
Mark
September 5th, 2010 at 10:53 pm
This worked great. Thanks very much!