

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:
- Copy and paste the code shown below into a file named rewrite.script
- Replace example.co.uk with your own site
- Upload to the root directory of your site
- Try out the redirect yourself in a browser
- 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:
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.