Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

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.

mod_alias alias

Discussion in 'General Discussion' started by dbrookeJP, Mar 2, 2018.

  1. dbrookeJP

    dbrookeJP Active Member

    Joined:
    Aug 24, 2016
    Messages:
    27
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Wisconsin
    cPanel Access Level:
    Root Administrator
    Per documentation here:
    Modify Virtualhost Containers With Include Files - Easy Apache - cPanel Documentation

    I am trying to create an alias, which does not seem to work.

    I've created the directory's and files here:
    /usr/local/apache/conf/userdata/ssl/2_4/jpadmin/store.<mydomain>.com/sitemap.conf

    and
    /usr/local/apache/conf/userdata/std/2_4/jpadmin/store.<mydomain>.com/sitemap.conf

    Inside the sitemap.conf files I have:
    <Location "/sitemap.xml">
    Alias "/sitemaps/sitemap_mydomain.xml"
    </Location>

    Then I did an apache restart in WHM.

    When I go here:
    https://mydomain.com/sitemap.xml

    I get a 404.

    Any ideas?
    Thanks,
    Donovan
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,182
    Likes Received:
    1,756
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Are you using EasyApache 3, or EasyApache 4? If you are using EA4, note the documentation is updated for EasyApache 4 and available at:

    Modify Apache Virtual Hosts with Include Files - EasyApache 4 - cPanel Documentation

    The correct paths for EA4 are:

    /etc/apache2/conf.d/userdata/std/2_4/user/domain/includename.conf
    /etc/apache2/conf.d/userdata/ssl/2_4/user/domain/includename.conf

    Also, if I understand correctly, I believe you are looking for an entry like the one referenced on this StackOverflow link:

    Apache Alias Question

    Thank you.
     
  3. dbrookeJP

    dbrookeJP Active Member

    Joined:
    Aug 24, 2016
    Messages:
    27
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Wisconsin
    cPanel Access Level:
    Root Administrator
    Was sure that was going to fix it!.. thx.. however, it is still not working.

    As the doc says, I made sure to do:
    /usr/local/cpanel/scripts/rebuildhttpdconf
    and
    /usr/local/cpanel/scripts/restartsrv_httpd

    I also created a more global version at:
    /etc/apache2/conf.d/userdata/ssl/2_4/jpadmin

    (thinking it may not pick up on the domain).

    I'm not sure if I have the right apache syntax now. I tried this one as well:
    Alias /sitemap.xml /sitemaps/sitemap_dolls_store_view.xml

    I wonder if there is a simple apache directive that I could add.. just to make sure the 'sitemap.conf' file is being triggered???

    Thx,
    Donovan
     
  4. dbrookeJP

    dbrookeJP Active Member

    Joined:
    Aug 24, 2016
    Messages:
    27
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Wisconsin
    cPanel Access Level:
    Root Administrator
    hmmm.. I also wonder if Magento's .htaccess file is messing with this (as I think .htaccess get's parsed before the userdata config ). Good thing it's the weekend. :)
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,182
    Likes Received:
    1,756
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Ensure to also run the following command after making the changes:

    Code:
    /usr/local/cpanel/scripts/ensure_vhost_includes --all-users
    Thank you.
     
  6. dbrookeJP

    dbrookeJP Active Member

    Joined:
    Aug 24, 2016
    Messages:
    27
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Wisconsin
    cPanel Access Level:
    Root Administrator
    Thanks Michael, still no go. Maybe I should explain a little clearer.. as maybe I'm not quite understanding how to do this.

    I have file in my HTML root at the path /sitemaps/sitemap_dolls_store_view.xml

    I am wanting any call to /sitemap.xml to alias that file.

    Right now it is not working (I get a 404):
    https://store.domain.tld/sitemap.xml

    Thanks for all the help!

    Donovan
     
    #6 dbrookeJP, Mar 2, 2018
    Last edited by a moderator: Mar 2, 2018
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,182
    Likes Received:
    1,756
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you open a support ticket using the link in my signature so we can take a closer look?

    Thank you.
     
  8. dbrookeJP

    dbrookeJP Active Member

    Joined:
    Aug 24, 2016
    Messages:
    27
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Wisconsin
    cPanel Access Level:
    Root Administrator
    Hi Michael, I would, but I don't have time.. I came up with a workaround using .htaccess:

    RewriteCond %{HTTP_HOST} (<yourdomain.com>) [NC]
    RewriteRule ^sitemap.xml$ /sitemaps/sitemap_<yourdomain>.xml [NC,L]


    I have Magento installed that is configured for multiple stores (domains).. which uses the same root directory of files.

    So, I needed to dynamically serve up sitemap.xml files (which is usually stored in the root directory) for each store instance based on domain.

    So, if anyone else runs into this.. the only way I could figure out how to do that (since I couldn't get mod_alias to work) was to use .htaccess... replace <yourdomain> with the text of your domain.

    Just an FYI.. I have ran into the mod_alias problem before. For some reason, I can never get it to work in cPanel.. when it is *really easy* to do in a server without cPanel.

    I wish I had time to look at it further, but I don't.

    Sincerely,
    Donovan
     
Loading...

Share This Page