dbrookeJP

Active Member
Aug 24, 2016
28
1
3
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
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,227
463
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.
 

dbrookeJP

Active Member
Aug 24, 2016
28
1
3
Wisconsin
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.
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
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,227
463
Hello,

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

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

dbrookeJP

Active Member
Aug 24, 2016
28
1
3
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
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,227
463
Hello,

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

Thank you.
 

dbrookeJP

Active Member
Aug 24, 2016
28
1
3
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