Rewrites are more complex and flexible thus it is always hard to explain in detail. Rewrite is a feature allowing the admin to define certain rules that let him change the actual URL used or simply redirect to another URL.
There are two modes the admin can use:
Non RegEx (simple string)
RegEx (regex replace)
Let's start with the classic. Non regex is for backward compatibility and for somebody also simple as it does not require any regex knowledge. Non regex does always perform HTTP redirect. Meaning the user will see the redirect in his browser.
Support for advanced functionality has been added: non port 80, protocol redirects, wildcard string replace.
There are several types of usage here:
Path Redirect
/data/ -> /otherdata/
E.g. http://server/data/xxx/xxx/a.txt -> http://server/otherdata/
This would replace the data folder in the URL with /otherdata/ BUT all things coming after /data/ would not be appended to other data.
Wildcard String Replace
The replace does not copy the appendix data to the destination. For that you would need to use string match with * wildcard. Note that it works with relative path, such as /test/* -> /mail/*.
icewarp.com* -> www.icewarp.com*
/data/* -> /otherdata/*
E.g. http://server/data/xxx/xxx/a.txt -> http://server/otherdata/xxx/xxx/a.txt
Also any other combinations are possible. You basically need to specify the asterisk in the destination too to take all remaining data from the source.
Last example illustrates the use with a web site integrated with SVN so nobody can access the .svn directories
*/.* -> /
E.g. http://server/mypage/.svn/... -> http://server/mypage/
This makes sure that any access to a directory starting with "." will be redirected to the root of the web page. If somebody wants to access the special /.svn/ directory, he will get only the public content associated with the address.
Host Redirect
It is also possible to specify the name of the virtual host
icewarp.com* -> www.icewarp.com*
E.g. http://icewarp.com/... -> http://www.icewarp.com/...
The example above would simply append www if not specified by the user.
This would be suitable only for the primary / default virtual host, since other virtual hosts are strictly based on their hostname.
Hostname MUST BE also in the destination as in the example.
This is how you would create a simple Host Redirect. The same as for Path Redirect applies here, too. The difference is made by the presence of the hostname at the beginning of the Source.
Protocol Redirect
Last usage allows you to use protocol specification
http://www.icewarp.com* -> https://www.icewarp.com*
E.g. http://icewarp.com/secure/* -> https://icewarp.com/secure/*
If a plain HTTP connection would be made to the /secure/ URI it would be redirected to HTTPS to the same directory. It also works vice versa, from https:// to http://.
All combinations of these can be used for non regex Rewrite.