Archived talk

Difference between revisions of "Zeus server"

From Joomla! Documentation

(Zeus rewrite server scripts)
 
m
Line 114: Line 114:
  
  
match IN:Host into $ with ^docklandsstudios\.ie$
+
match IN:Host into $ with ^yoursite\.com$
 
if matched
 
if matched
 
match URL into $ with ^/(.*)$
 
match URL into $ with ^/(.*)$

Revision as of 09:41, 21 February 2010

Today I discovered that my hosting company uses a Zeus and not Apache server!!

The issues are with my Joomla 1.5 site are:

1. Search Engine Friendly URLs do not function correctly and if I switch it on all the links on my site break.

2. The Apache mod_rewrite functionality does not work correctly.

3. 301 re-directs do not function correctly.


As Zues server technology does not recognise .htaccess scripts - the solution is to write a rewrite.script and place it in the root directory of your website.

These rewrite.scripts are difficult to find on the web as they are not widely published nor are they supported by hosting companies generally.


A Zeus 301 re-direct looks like this:

match IN:Host into $ with ^yoursite\.com$ if matched match URL into $ with ^/(.*)$

 	if matched
 	set OUT:Location  = http://www.yoursite.com/$1
 	set OUT:Content-Type = text/html
 	set RESPONSE = 301
 	set BODY = <a href="http://www.yoursite.com/$1">Click here if you are not automatically redirected</a>
 endif

endif


A Zeus SEF URLs script looks like this:


   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:


And a Zeus 301 redirect with SEF URLs functionality looks like this:

   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


match IN:Host into $ with ^yoursite\.com$ if matched match URL into $ with ^/(.*)$

 	if matched
 	set OUT:Location  = http://www.yoursite.com/$1
 	set OUT:Content-Type = text/html
 	set RESPONSE = 301
 	set BODY = <a href="http://www.yoursite.com/$1">Click here if you are not automatically redirected</a>
 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: