SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Aug 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Combine multiple rewrite rules for Zeus

    Currently, i have working with a Zeus server and we have a website which is developed using Wordpress. Zeus Sever don't support the .htaccess file which is required to install wordpress and also for the SEO. however, there is another way we can manage Zeus to achieve our tasks by defining some rewrite rules.

    For WordPress we are currently Using the following Rewrite rules:


    Code:
    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?EUR(TM)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:

    need a sub domain for our project:

    Our hosting service provider "netregistry.com.au" is not based on Cpanel which makes our job harder to setup a Subdomain. Netregistry provide a tutorial which guide us to setup the subdomain.

    http://www.netregistry.com.au/suppor...to-a-directory

    however, to make the subdomain work we need to add some rewrite rule for the server Zeus.

    The following rewrite rule we need to add:

    Code:
    RULE_1_START:
    insensitive match IN:Host into % with ^www.example.com.au
    if  matched then goto END
    RULE_1_END:
    
    RULE_2_START:
    insensitive  match IN:Host into % with ^(.*).example.com.au
    if matched then match URL  into $ with ^/(.*)
    if not matched then goto RULE_2_END
    set URL =  /%1/$1
    RULE_2_END:

    problem is we already have written rule 1 for the Wordpress. and if we place rule 1 again server will irnore the rule 1. Anyone have any idea how we can combine rewrite rules?

    Please help us to combine WordPress and subdomain rewrite rule together

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,672
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    e33,

    What's the difference between the first insensitive match lines? Okay, I would replace (.*) with ([a-z]+) but that's because (.*) causes so many problems. Since (.*) will match www, all you need is the second rule.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    SitePoint Member
    Join Date
    Aug 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dklynn View Post
    e33,

    What's the difference between the first insensitive match lines? Okay, I would replace (.*) with ([a-z]+) but that's because (.*) causes so many problems. Since (.*) will match www, all you need is the second rule.

    Regards,

    DK
    Thanks for ur reply. actually i don't have to much idea about the sever rewrite rules. this rewrite rule i have mentioned for the subdomain is provided by my hosting company "netregistry.com.au"

    if i only use the second rule, there is the possibility not to reach the second rule as after the first rule the program will jump to the QSA_RULE_START: and if we see the "QSA_RULE_START:" code, its terminating further execution.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •