Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Zeus rewrite.script

Options
  • 27-09-2011 7:53pm
    #1
    Registered Users Posts: 126 ✭✭


    Need to convert the following mod_rewrite script to a zeus rewrite.script this will be for eliminating trailing slash, if any one has any info that would be great as its the only thing preventing me from uploading my SEO friendly site.

    RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]


Comments

  • Registered Users Posts: 16,413 ✭✭✭✭Trojan


    1) Ask your hosting company.

    2) If they won't help, move to one of the 99.999% of hosting companies that let you use a user friendly web server that supports rewrites (even IIS is more user friendly).

    In fact, I'd skip straight to 2.


  • Registered Users Posts: 126 ✭✭cusackd


    Trojan wrote: »
    1) Ask your hosting company.

    2) If they won't help, move to one of the 99.999% of hosting companies that let you use a user friendly web server that supports rewrites (even IIS is more user friendly).

    In fact, I'd skip straight to 2.

    Ah yeah i've given it taught and i've no time to be learning zeus and putting up with poor customer support so i've already got in touch with the guys over in http://www.webworld.ie/ and they're giving me loads of help with the migration


  • Registered Users Posts: 459 ✭✭CSU


    Here's a copy of mine might be of use to you...
    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:
        
    # ***** SECURITY TO PREVENT CASPER ATTACKS ***** 
    match IN:Host into % with ^(.*)  
    match URL into $ with ^/(.*)\?(.*?(proc|self|environ|mosConfig_[a-zA-Z_]{1,21}(=|\%3D)|base64_encode.*\(.*\)|(\<|%3C).*script.*(\>|%3E)|GLOBALS(=|\[|\%[0-9A-Z]{0,2})|_REQUEST(=|\[|\%[0-9A-Z]{0,2})))  
    if matched then  
    set OUT:Location=http://%1/$1  
    set OUT:Content-Type = text/html  
    set RESPONSE=301  
    set BODY=Moved Permanently  
    goto END 
    endif 
    # ***** PREVENT REWRITE.SCRIPT, .HTACCESS, .HTPASSWD AND .HTGROUP FILES BEING READ IN A BROWSER ***** 
    match URL into $ with ^/(rewrite\.script|\.htaccess|\.htpasswd|\.htgroup) 
    if matched then 
    set URL = / 
    goto END 
    endif 
    # ***** CHECK IF THE URL BEING CALLED EXISTS AS A FILE OR DIRECTORY ***** 
    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 
    # ***** REDIRECT ALL OTHER REQUESTS ***** 
    match URL into $ with ^/index\.php 
    if not matched then 
    match URL into $ with (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ 
    if matched then 
    set URL=/index.php 
    goto END 
    endif
    endif
    


Advertisement