URL rewriting: Zeus

From Smart Job Board help

Smart Job Board Help > URL rewriting: Zeus
Jump to: navigation, search

Zeus web server does not support .htaccess rules, however it has own URL rewriting procedure.

 Note: the images used in the instructions below are examples, it may look different on your server.

Setting
1. Open virtual host config

          Image:Configure.png


2. In Zeus Admin Panel go to Virtual host settings and click on the "Request Rewriting" section link to open it:

          Image:Request rewriting.png


3. Check “Enabled” to turn on “Enabling Request Rewriting”. And then enter the rewrite script to the"Rewrite Script" field. (The code of the script can be found further).

           Image:Enable rewrite.png


4. Apply changes pressing the “Apply” button:

            Image:Apply changes zeus.png


5. Commit changes pressing the “Commit” button:

            Image:Commit.png


Script


Template

RULE_1_START:
match URL into $ with ^/{$rewrite_path}admin/\.\./
if matched 
  map path into SCRATCH:path from %{URL}
  look for file at %{SCRATCH:path}
  if exists then goto END
endif

match URL into $ with ^/{$rewrite_path}admin/[^?]*(.*)
if matched 
 set URL = /{$rewrite_path}admin/index.php$1
 goto END
endif

map path into SCRATCH:path from %{URL}
look for file at %{SCRATCH:path}
if exists then goto END
look for dir at %{SCRATCH:path}
if exists then goto END

match URL into $ with ^[^?]*(.*)
set URL = /{$rewrite_path}index.php$1
RULE_1_END:



Example 1

If the software installed to www root, then {$rewrite_path} should be replaced with a empty value

RULE_1_START:
match URL into $ with ^/admin/\.\./
if matched 
  map path into SCRATCH:path from %{URL}
  look for file at %{SCRATCH:path}
  if exists then goto END
endif

match URL into $ with ^/admin/[^?]*(.*)
if matched 
 set URL = /admin/index.php$1
 goto END
endif

map path into SCRATCH:path from %{URL}
look for file at %{SCRATCH:path}
if exists then goto END
look for dir at %{SCRATCH:path}
if exists then goto END

match URL into $ with ^[^?]*(.*)
set URL = /index.php$1
RULE_1_END:



Example 2

If on the http://www.example.com hosting the path to www root directory is: /home/user/www/, and the software installed to sjb subdirectory (/home/user/www/sjb), and has the following URL: http://www.example.com/sjb, then consequently{$rewrite_path} = sjb/.

RULE_1_START:
match URL into $ with ^/sjb/admin/\.\./
if matched 
  map path into SCRATCH:path from %{URL}
  look for file at %{SCRATCH:path}
  if exists then goto END
endif

match URL into $ with ^/sjb/admin/[^?]*(.*)
if matched 
 set URL = /sjb/admin/index.php$1
 goto END
endif

map path into SCRATCH:path from %{URL}
look for file at %{SCRATCH:path}
if exists then goto END
look for dir at %{SCRATCH:path}
if exists then goto END

match URL into $ with ^[^?]*(.*)
set URL = /sjb/index.php$1
RULE_1_END:
Personal tools
Toolbox