I never had any success with creating custom template, I know that the developers have told me in the past that I can put exactly same thing in Custom template as I do into .htaccess file, but I could never get it to work. When I created custom template, nobody could get access to the site, but when I copied exactly the same information into .htaccess file, everything worked fine. So now I don't even bother with custom template any more, I just use .htaccess file.
In order for the .htaccess file to function properly with simlinks, you have to issue the following command:
db accounts setprop ibayname FollowSymLinks enabled
db accounts setprop ibayname AllowOverride All
signal-event ibay-modify ibayname
Replace the ibayname with name of the ibay where domain.com is located