WordPress Permalinks on a Namesco Zeus Server

Monday, 1st March 2010

I 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 = %
set SCRATCH:REQUEST_URI = %
 
# 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 = %&%{SCRATCH:QUERY_STRING}
endif
goto END
QSA_RULE_END:
garcinia cambogia dr oz
http://airconairsupply.ti-albums.net/

38 Responses to “WordPress Permalinks on a Namesco Zeus Server”

  1. Charlie Says:

    Cheers, life saver!

  2. Alex Says:

    Much appreciated, just what I was after!

  3. Phil Says:

    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

  4. Ben Says:

    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?

  5. Mark Says:

    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

  6. Alan Feekery Says:

    This worked great. Thanks very much!

  7. ithinkitsnice Says:

    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.

  8. Stuart Burman Says:

    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?

  9. CheesyRabbit Says:

    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!

  10. Mark Straiton Says:

    Great fix – many thanks!

  11. David Lockie Says:

    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

  12. Ian Hallworth Says:

    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 .

  13. sunil Says:

    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

  14. sunil Says:

    My problem is solved

    thanks

  15. DavidM Says:

    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?

  16. kimochi Says:

    Thanks for this! I’ve been looking for a Zeus rewrite and this was the only one that worked! Thumb up ^_^

  17. Vinny Says:

    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!

  18. Rob Says:

    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.

  19. Jon Dunn Says:

    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!

  20. Jim Fitzsimons Says:

    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.

  21. Neil Says:

    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.. :)

  22. Huw Rowlands Says:

    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!!

  23. Ben Says:

    @Huw, have you tried the code in @CheesyRabbit’s comment above for it to work in a subfolder?

  24. Shane Says:

    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…? :(

  25. Mike Abbott Says:

    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.

  26. barry Says:

    You saved me a lot of time!

    Thanks a mill.

  27. Sanliv Says:

    Thank you to share with us! It helped me a lot to update the parmalinks working!

  28. Joel Bardsley Says:

    Thanks a lot for sharing this Ben – worked a treat on my Namesco host.

  29. Tom Says:

    Ben, You are a legend.. Thanks so much for sharing this, I honestly thought i was going mad at one point :-)

  30. Roger Perkin Says:

    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

  31. David Says:

    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.

  32. Matt Says:

    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?

  33. Niall Flynn Says:

    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 :)

  34. Hayley Says:

    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! :(

  35. Steve Says:

    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.

  36. Joke de Winter Says:

    Thank you!
    You saved me a day of frustration.

  37. Nick Says:

    Legend! I only lost 20mins!

  38. Robert Says:

    Thanks for this, the script in your post works fine for me on Namesco, much prettier.

    This is especially helpful as the Adam Christie post seems to have gone away

    Ta

Leave a Reply