ozzieonline

Well-Known Member
Dec 20, 2012
126
0
16
cPanel Access Level
Root Administrator
I was finally able to rewrite www.my-main-domain.com/website/image.jpg internally to home/xxx/public_html/website/my-main-domain.com/image.jpg.

I adjusted the vhost.local template and added this line:

AliasMatch ^/website/(.*)$ /home/xxx/public_html/website/[% vhost.servername %]/$1

As you can see I used the [% vhost.servername %] variable from the template to retrieve the domain name. Works like a charm and I was all happy (took me a few hours to find out)... untill... I tried to add an add-on domain.

The problem is that in an add-on domain the value of this [% vhost.servername %] is something like this addondomain.my-main-domain.com while it should have been this addondomain.com. As a result my solution for the AliasMatch doesn't work anymore. Very frustrating.

Is there a way to modify [% vhost.servername %] in the template file? For example is there a way to strip the part between the dots so addondomain.my-main-domain.com becomes addondomain.com?

Please help! (If this is not possible then I would like to know as well.)