Zeus web server rules for X-Cart CDSEO Pro module

A lot of people use Zeus web server, some of them face a problem with CDSEO Pro module work with the server. It is strange to see that the recommended rules do not work in some cases. As a result URLs generated by the module are not loaded properly, and you can face a redirect loop.

Below you can find description of implementation of correct CDSEO Pro rules for Zeus server that would work in all situations:

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}

# we check if there are 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:
# preparing to search for a file, rewrite if it's not found
set SCRATCH:REQUEST_FILENAME = %{SCRATCH:DOCROOT}
set SCRATCH:REQUEST_FILENAME . %{SCRATCH:REQUEST_URI}

# we 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 = /cdseopro.php
    goto QSA_RULE_START
  endif
endif

# if we made it here then it's a file or a 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:

Should you have any questions about the implementation rules or if you need assistance with the module work on your server feel free to contact us.