Get in Touch
Sitemap

A rewrite.script file to replace .htaccess files for Expression Engine users on Register365

June 22, 2009

Namesco a.k.a. Register365 are soon to begin the process of moving their users from a 'legacy' H-Sphere system to a new hosting platform. Annoyingly, they don't really mention that the new platform runs on Zeus server software rather than Apache. This is set to cause headaches for a lot of users as urls which are rewritten using the mod_rewrite module will no longer work.

image

Although users will be automatically moved at some point in the future, you can choose to manually move your data and reconfigure any settings now should you so wish.

Which is what we did for one of our clients over the weekend. Only to find that the “Linux Web Hosting” package is on a Zeus server. Whoever heard of the LZMP stack?

Anyhow, the first casualty was our SEO and human friendly URLs. So if you’re using Expression Engine on a Names.co.uk or Register365.ie Zeus server, and you’ve been dropping the index.php from URLs by using mod_rewrite in a .htaccess file, then this is for you:

Create a rewrite.script file - this goes into the same directory as your old .htaccess file.

Copy the following code into the file:

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
# check it’s not webmail or controlpanel or tech_support
match SCRATCH:ORIG_URL into % with ^/webmail|^/tech_support|^/controlpanel
if matched then
goto END
else
set URL = /index.php%{SCRATCH:REQUEST_URI}
goto QSA_RULE_START
endif
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:

Please note, this code is almost entirely based on work found in this post: http://drupal.org/node/46508 which was customised for Names.co.uk so as not to break the /controlpanel and /webmail urls. We just added a tiny bit of extra customisation to get it working properly for Expression Engine.

You should also note that for the most part a .htaccess file will still run smoothly on Zeus.

Finally, I’ve had it confirmed by support at Namesco / Register365 that CRON jobs are not supported on Zeus servers - although they might help you out if you plead your case…

By the way, if people have any opinions on why they use Zeus over Apache servers - we’d love to hear them.

 

15 Comments

1

Adley | Sun Mar 7, 2010 at 05.37 am

Very impressed with the knowledge you are posting here. Thanks for sharing and let us know more about new releases.
pc repairs

2

Abbott | Mon Mar 1, 2010 at 07.08 pm

This is just another reason why I like your website. I like your style of writing you tell your stories without out sending us to 5 other sites to complete the story.
stubby holders

3

Jorge | Fri Feb 12, 2010 at 10.42 am

Great idea - so many times we can think that we can only try one of these tips at a time to get the results we desire. How much further from the truth could that be? When they are all used in conjunction we can multiply our return.
placemat

4

Portland Oregon SEO | Tue Jan 19, 2010 at 09.58 am

Nice blog post. I got to learn some important and useful information.

5

Mark Ewans | Sun Jan 3, 2010 at 05.45 pm

One of my goals requires that I find the time to exercise.  I’m trying to visualize how online coaching can help me wit this goal.
Personal massager

6

cheap dedicated server | Fri Dec 18, 2009 at 07.38 am

Expression Engine is a content management system build with PHP. So if you find a hosting having PHP support with MySQL databases, you are ready to go.Code Intiger is a framework built on PHP, it’s for programmer to create a modular advanced website.
cheap dedicated server

7

Professional Development Courses | Thu Dec 17, 2009 at 02.09 pm

Sounds interesting, how effective is this? Any feedback?

8

SEO Training | Fri Dec 4, 2009 at 01.37 pm

What a well written great piece of information. I remember that I was looking for something like this from a couple of months. I am glad that I found my way here by coincidence!

9

Los Angeles Website Design | Sat Nov 28, 2009 at 09.13 am

I have clear cut idea about expression engine user.. Thanks..
Los Angeles Website Design

10

norman @ tell a friend | Tue Nov 17, 2009 at 02.51 am

Oh great! This one must be good. Ive tried so many alternatives and yet I haven’t found the best one for me. If there is some questions I want to ask and detail to confirm. Can this be easier to start with?

11

Thiwanka | Mon Nov 16, 2009 at 02.49 pm

Could you please tell me how I can change
RewriteRule ^test/([A-Za-z0-9_\-]+)/([A-Za-z0-9_\-]+)/?$ test.php?username=$1#=$2

to use in Zeus server ?

12

James | Thu Nov 5, 2009 at 04.31 pm

Hey there. Thanks for this, finally I can mess with Expression Engine.

Ive been a namesco customer for 6 or 7 years and can explain the Zeus thing smile

Once upon a time there was a smaller hosting company called simply.com offering good prices and fast servers, even the shared hosting was awesome. Heck, you even got Plesk on the shared hosting which is fairly unusual. But they did run Zeus instead of Apache and it was never a problem for me - until i started fiddling with the likes of Wordpress, and Expression Engine. And then came along Namesco who bought simply.com and their customers, got rid of plesk and kept Zeus, purely becuase they didnt want to move thousands of customers onto an apache platform. So there it is.

Wordpress is an easier one. If you dig in the control panel youll notice an auto-installer for that. Theres a zeus rewrite script on sniplr if you like to do things manually. No cigar for EE in the control panel though as far as i know.

Personally, I find Zeus faster then Apache and its a security plus in my book. Apache is so widespread, it makes it vulnerable to attack. Someoone wishing to compromise a Zeus server will most likely need to do some homework, or just not bother.

My 2 pence worth. smile

Thanks again for the script.

13

Man | Tue Nov 3, 2009 at 03.37 pm

I can recommend to visit to you a site on which there are many articles on this question.

14

Sean Owens | Wed Sep 16, 2009 at 01.22 pm

Very interesting, the cron jobs one we knew about already but not the zeus one. Funny we were not told about that “minor” part. I dont really understand why they are with Zeus but I guess when you are as big as they are you call the tunes.

Will have fun with this for joomla.

15

Bruce | Wed Sep 16, 2009 at 06.04 am

You’re a lifesaver for writing this up, there’s not a lot of support out there for Zeus users to convert .htaccess rules.

I copied this out as you have it, and tried to put it on my server but it did not work.  I tried adding it as a rewrite.script file in the root directory of my site, and have also tried adding it via my admin console but no dice either way.

Is there anything in the script I should change up to suit my EE install, and EE settings I need to change, or should I get on my web host’s case?

Leave a Comment

Remember my personal information

Notify me of follow-up comments?