Cubecart v5 rewrite.script for Zeus

If you're running Cubecart v5 on Namesco or another host that uses the Zeus webserver, you'll need this to have nice SEO URLs.
An Apache rewrite file is provided for those who run Cubecart 5 on the Apache webserver. But what about those who use a web hosting company with Zeus instead of Apache. Well here's the script I currently use for my clients. It's working well for us but I can't provide any guarantees that it will work for you, so please test first.
To install it simply add the text below into a file and save it as rewrite.script, or download it. Then upload it to the root of your Cubecart 5 site.
RULE_0_START:
# set original URL
set SCRATCH:ORIGINAL_URL = %{URL}
set SCRATCH:REQUEST_URI = %{URL}
# Set Root Relative Path
set SCRATCH:ROOT_REL = /
# don't rewrite certain files
match URL into $ with ^/.*\.(gif|jpg|png|css|js).*$
if matched then
goto END
endif
# check for query string and set accordingly
match URL into $ with ^(.*)\?(.*)$
if matched then
set SCRATCH:QUERY_STRING = $2
set SCRATCH:REQUEST_URI = $1
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
#remove remove forward slash
match SCRATCH:REQUEST_URI into $ with ^/(.*)$
if matched then
set SCRATCH:REQUEST_URI = $1
endif
#remove .html from the end if it's there.
match SCRATCH:REQUEST_URI into $ with ^(.*)\.html$
if matched then
set SCRATCH:REQUEST_URI = $1
endif
#set BODY = /index.php?seo_path=%{SCRATCH:REQUEST_URI}
#goto END
set SCRATCH:REQUEST_URI = /index.php?seo_path=%{SCRATCH:REQUEST_URI}
goto QSA_RULE_START
#goto END
endif
endif
# if we made it here then its a file or dir and no rewrite
#set BODY = %{SCRATCH:REQUEST_FILENAME}
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:ORIGINAL_URL into % with \?(.*)$
if matched then
#set BODY = %{SCRATCH:REQUEST_URI}&%{SCRATCH:QUERY_STRING}
set URL = %{SCRATCH:REQUEST_URI}&%{SCRATCH:QUERY_STRING}
else
#set BODY = %{SCRATCH:REQUEST_URI}
set URL = %{SCRATCH:REQUEST_URI}
endif
goto END
QSA_RULE_END:
Older topics:
How to fix Firefox search to use the local Google search
Does your Google search box send you to google.com instead of the site for your country? Here's the fix.
Web Hosting: Beware of Fake Review Sites
Create Your Own Layer for Google Maps on Android
Here's how to use POI data as a Maps or Nav layer.
WebsiteBaker: Removing /pages/ from the URL
Shorten your WebsiteBaker URLs by removing /pages/
Comments are moderated so there may be a delay before your comment appears. Thanks for your patience.
May 15 2012
Roland
Works great - saves me hassling the client to move away from Namesco!