Realising Designs Articles


Date icon Posted: July 30th, 2008

Post icon Zeus Webserver 301 Permanent Redirect non-www to www site

Google Buzz

Zeus Webserver Logo

I have just been on a long and winding journey of web pages with Zeus codes that just didn’t work for me. At least for now I am at the end and have a working rewrite.script that redirects all non-www pages to their www counterparts. To apply the following:

  1. Copy and paste the code shown below into a file named rewrite.script
  2. Replace example.co.uk with your own site
  3. Upload to the root directory of your site
  4. Try out the redirect yourself in a browser
  5. User a HTML Server Response checker to make sure all is ok

Below is the code, which should not be changed with the exception of the domain name and be sure to escape the . with a \ in line 2 e.g. example\.com, example\.co\.uk:

?Download download.txt
1
2
3
4
5
6
7
8
9
10
11
RULE_0_START:
match IN:Host into $ with ^example\.co\.uk$
if matched then
match URL into $ with ^/(.*)$
    set OUT:Location = http://www.example.co.uk/$1
    set OUT:Content-Type = text/html
    set RESPONSE = 301
    set BODY = Moved
goto END
endif
RULE_0_END:

If you find this code useful or even find it doesn’t work for you, then please let me know. You can now combine this with our free HTTP Server Response tool to check your 301 Redirect is working as it should.

Share This Post

Share this post:

Delicious Icon   Digg Icon   Redditt Icon   Facebook Icon   StumbleUpon Icon

10 Responses to 'Zeus Webserver 301 Permanent Redirect non-www to www site'

  1. markd says:

    Haha nice! At last some decent code for global redirects on Zeus, been looking everywhere on the net.

    Thanks a lot, it work for me hehe, used it on destinationmalta(.)com
    We are redesigning whole website and wanted to make sure we got non-www in order first!

    One small thing, if I want to redirect (as well) just 1 old url to a new one, may I ask for some help here too?

    Thanks a million :P

  2. James says:

    Great and hope it helps. I do have a script that I was in the process of trying out that does a Zeus permanent redirect the main index page to the root (and vice versa). I will dig it out for you as it appears to work well and could easily be tweaked for your website.

    James

  3. James says:

    Hi Mark, you should be able to try something like this code appended after your original rule:

    RULE_1_START:
    match URL into $ with ^\/oldpage.html$
    if matched then
    set OUT:Location = http://www.example.co.uk/newpage.html
    set OUT:Content-Type = text/html
    set RESPONSE = 301
    set BODY = Moved
    goto END
    endif
    RULE_1_END:

    Please let me know if it works and it may ease a few others headaches.

  4. markd says:

    I tried the latest script to redirect language.htm (from same domain mentioned above) to learn-english-malta.htm

    Haha it works too :P

    Great thanks mate, it’s almost fun now!

  5. James says:

    Maybe Zeus isn’t so bad after all!

    Glad to help out and also glad to have my own redirects working after so much messing around!

  6. vidhatanand says:

    i have a wordpress blog on zeus server, and i am not able to make out how to get the permlinks working. i am in urgent need of it. please help me out with it.

  7. James says:

    If you Google “zeus mod rewrite wordpress”, result number 1 has a savagely sized rewrite script that might help you.

  8. markd says:

    I checked “zeus mod rewrite wordpress” on Google and sent me back here. I too was looking forward to make wordpress permalinks work, maybe you can help us out.

    Haha seems you’re the only pro around :D

  9. markd says:

    I searched for exact match with “…”, without managed to find something now, will give it a try later :P

  10. James says:

    Hi Mark,
    I have not tried much with WordPress, though have got things working for my own custom builds with the same script, so pretty sure it should be okay. You can see it on a post of mine here.

    James

Leave a Reply

CommentLuv Enabled


Copyright © 2005-2010 Realising Designs Limited

Tel: 0800 634 8536 / Itnl +44(0)1227 787027

Home