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!
October 3rd, 2010 at 12:02 am
Oh god, thank ****.
I’ve been pulling my hair out all night trying to fix this for a client that bought their own hosting. It wasn’t until I googled the host’s name alongside the problem that this came up.
Works a charm. Thank you.
October 7th, 2010 at 8:07 pm
Hi – am stuck with this issue too. Nearly ripping what’s left of the hair out. Finally figured it was with Namesco rather than Wordpress or .htaccess.
However, my wordpress install is in a subdirectory and not sure how to configure this script for the subdirectory name – I guess it’s wuite simple but am a noob at Zeus. Can you help?
October 29th, 2010 at 2:26 pm
I have just found some code that works for my blog in a sub directory and thought I would share.
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:
*************************************************
Alter this line to your url:
set URL = /index.php?q=%{SCRATCH:REQUEST_URI}
for example:
set URL = /blog/index.php?q=%{SCRATCH:REQUEST_URI}
Hope it helps!
November 10th, 2010 at 1:52 pm
Great fix – many thanks!
November 29th, 2010 at 7:59 am
Hi Ben,
Sweet script, works a treat, thanks.
Wondering if anyone else gets errors in the WP CMS using Zeus? I get files in wp-admin/images and wp-includes that aren’t being served, despite them being right there on the server.
Wondering if there are some additional rewrites needed for the CMS or if it’s just some weird corruption with my install. Anyone else noticed this?
David
December 14th, 2010 at 3:08 pm
I was having an issue with the query string not working properly on Namesco.
This works fine in Apache –
http://www.domain.com/whats-on?when=next
but not Zeus.
Had to change the format of the query string to
http://www.domain.com/whats-on/?when=next
i.e I added a backslash before the ?
Hope that helps someone .
February 7th, 2011 at 11:15 am
my site URL is http://domain.co.uk/sunil/
I have also used the above rewriting rule in my rewrite.script file. But its not working for me. Please suggest something.
Thanks
February 7th, 2011 at 1:33 pm
My problem is solved
thanks
February 16th, 2011 at 3:06 am
This all is good news to my Wordpress-loving ears. But I was wondering, has anyone set up a Wordpress multisite?
I can only imagine the complications that might arise from multisite use, but I figured, I should at least see if anyone has found or created a viable solution.
In case anyone doesn’t know, Wordpress now has an integrated ability to extend so that one Wordpress install can be used to administer practically unlimited sub-sites.
And with that comes the rewrite obstacles! Anyone aware of any zeus solutions for multisite or wpmu?
March 12th, 2011 at 12:39 am
Thanks for this! I’ve been looking for a Zeus rewrite and this was the only one that worked! Thumb up ^_^
March 22nd, 2011 at 2:02 pm
Great, thanks. Was wondering why none of the permalinks worked. Namesco have a control panel where you can enter the script but I wouldn’t use that as it gives errors. Simply save the above (well-written script) and paste into a text file – upload to the root of your site and rename as rewrite.script.
Thanks again for this script. You have to love Zeus!
March 24th, 2011 at 7:30 pm
Hi,
I have a slight more complex question. I have just moved over to register365 which is basically namesco rebadged and discovered the hard way that Zeus is a pile of shite when it comes to my wordpress sites.
My scenario is that I use a site (say http://www.site.com) as a development sandbox, so I have multiple sub-ites (ie http://www.site.com/client1, http://www.site.com/client2 and so on) each with its own wordpress installation.
This Zeus thing is all new to me so I was wondering if anyone had a Zeus script that would work for a Wordpress site that also supports sub-sites? All help greatly appreciated.
March 29th, 2011 at 8:28 pm
This script and the comment by @Cheesyrabbit have really helped me with my WP site on a Zeus server. Namesco’s own script didn’t even validate in their control panel, so I uploaded this one manually (with /wp edited in before /index.php as my site is in a sub-folder) and it worked a treat. Some links still don’t resolve but I think it’s because they’ve been set up differently in the theme, so my next challenge is to actually understand the script and change it for my particular site. But 90% sorted by this post so thanks again!
April 12th, 2011 at 11:36 pm
Just like to add a massive “thank you” to Ben here. That script has been a massive help. The Namesco control panel is a bit of a joke, but once I’d uploaded it as rewrite.script, everything worked perfectly.
June 13th, 2011 at 3:51 pm
Hello, i have literally been pulling my hair out with this issue with the zeus server.
Your fix worked perfectly, thanks for the help!
Seriously, a huge thank you.. :)
July 4th, 2011 at 8:38 am
Hi,
I cannot get this to work :(
My blog is in a subfolder and have placed the rewrite.script url in there, the root of my WP blog. But nothing changes. Still getting 404′s.
Please help!!
July 4th, 2011 at 1:13 pm
@Huw, have you tried the code in @CheesyRabbit’s comment above for it to work in a subfolder?
July 4th, 2011 at 10:57 pm
This is exactly what I’m looking for, albeit for a website developed using the zend framework which is in a sub directory on a namesco zeus server…
I’m completely new to zeus and rewrite.script files. If anyone can give me any pointers as to how I would go about removing the sub directory + public + index.php from my urls I would be eternally grateful!
Why couldn’t I have just picked an apache host…? :(
July 11th, 2011 at 3:18 pm
Many thanks for this page. It’s working for me. I’ve found Namesco to be a pretty good hosting Co, but as a wp newby I think that they could do more to help clients with this issue.
July 29th, 2011 at 1:55 pm
You saved me a lot of time!
Thanks a mill.
October 27th, 2011 at 3:47 pm
Thank you to share with us! It helped me a lot to update the parmalinks working!
January 26th, 2012 at 1:41 pm
Thanks a lot for sharing this Ben – worked a treat on my Namesco host.
February 2nd, 2012 at 11:58 am
Ben, You are a legend.. Thanks so much for sharing this, I honestly thought i was going mad at one point :-)
April 3rd, 2012 at 9:48 am
Can somone clarify the root, is it the root of your site or domain.
My domain is rogerperkin.co.uk my blog sits in /ccie
Do I put the rewrite script in /ccie or /
If I put it in / do I then make the adjustment
set URL = /ccie/index.php?q=%{SCRATCH:REQUEST_URI}
Or will it work the same in the root of the wordpress site.
I was then not sure if in my permalinks I have to remove /index.php as I currently have
/index.php/%category%/%postname%/
I seem to have tried every which way but and it does not work.
The problem is I don’t exaclty understand what the rewrite script is doing.
If I set my blog pages to have a index.php in them will the rewrite script rewrite it to remove it or if I remove it does zeus put it back and then the rewrite script removes it – bit confused.
Surely it can’t be that hard… but is has me stumped.
Thanks
Roger
UK
July 12th, 2012 at 11:40 pm
I’d like to know the answers to the questions put by Roger above as well. I have a WordPress site on Namesco and it is a multi-site installation but only the first site works: child site are apparently created but they give 404s. I couldn’t get the script given by Cheesyrabbit to make any difference in any configuration I tried.
July 26th, 2012 at 3:03 pm
I’m having the same issues on a WP single site install. I’ve added the ‘rewrite.script’ file to my root (and /web/) and it’s still not working.
This is so frustrating and should be a simple fix – any ideas? …please?
August 13th, 2012 at 12:32 pm
I have a similar fix posted on my site, FYI this is the tip of the iceberg. I find there hosting is just not suitable for WP, very tricky to get some core functionality in, nice post :)
November 19th, 2012 at 6:13 pm
I have the same problem as Matt – I’ve added the rewrite.script to my /web domain but still nothing changes. This isn’t a sub directory is it?
Any help is welcomed, I’m losing the will to design! :(
February 7th, 2013 at 12:17 pm
Hi there, has any managed to write a Zeus rewrite script for WP Multisite for pretty permalinks /%category%/%postname%/? Any push or SHOVE in the right direction would be most welcome. Thanks, Steve. FORGOT to mention it is on a sub-domain installation.