The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

vhost template

Discussion in 'General Discussion' started by ozzieonline, Jan 16, 2013.

  1. ozzieonline

    ozzieonline Well-Known Member

    Joined:
    Dec 20, 2012
    Messages:
    126
    Likes Received:
    0
    Trophy Points:
    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.)
     
Loading...

Share This Page