Support - Knowledge base

Giving you the answers you need

Why not try our knowledge base for instant help and advice to enhance your online experience with Register365? From within the knowledge base you can browse our frequently asked questions and find the right answers to help solve your queries.

Home  >  Scripting  >  Rewrite Scripts  >  View Article

Converting a Joomla! mod_rewrite script to Zeus 'rewrite.script'

2*2*2*2*2*

Article

Joomla! websites

If you have real paths that match /content/ or /component/ then you need to check that the request isn't for a real file. Only use this code if you actually need it because it requires a lot more processing time than the alternative below. You will need to use this rewrite rule:

match URL into $ with (/content/|/component/)   
if matched then      
    map path into SCRATCH:path from %{URL}      
    look for file at %{SCRATCH:path}   
    if not exists then look for dir at %{SCRATCH:path}   
    if not exists then set URL = /index.php   
endif

If you don't have real paths like /content/ or /component/ then you only need this:

match URL into $ with (/content/|/component/)   
if matched then set URL = /index.php

For full SEO friendly URLs and mod_rewrite support options enabled in your Joomla installation, please use

# ***** 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 ^/joomla/index\.php 
if not matched then 
match URL into $ with (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ 
if matched then 
set URL=/joomla/index.php 
goto END 
endif 
endif

Rate This Article

How useful was this article?

Not useful A little useful Useful Very useful Everything I needed