How to submit a sitemap.xml to Google Webmaster when using Heroku hosting

You may be facing the need to notify Google of your sitemap file, but you don’t know how because you have a rails app running on Heroku.

Ok, here is my hint to sort it out.

My setting is a rails app where I use a gem called sitemap-generator that you can see here: https://github.com/kjvarga/sitemap_generator. This gem works great, by the way.

My app is hosted in Heroku. And as you may probably know, Heroku does not have space for files, so you need to host everything in another server. In my case I use cloud hosting in Amazon, using Amazon Web Services S3.

So my sitemap is stored in the following address:

https://s3-us-west-2.amazonaws.com/myapp-production/maps/sitemap.xml.gz

And this is the url you have to submit to Google Webmaster. In order to set up the Webmaster account, you cannot do it with the true domain, because then you cannot refer to the file. I mean, that if your domain is “myapp.com” then google will expect that you submit an xml file after myapp.com/…

So you have to create a new account starting with https://s3-us-west-2.amazonaws.com/myapp-production/ and then add your sitemap file to be submitted.

Also, in my application I am using multiple subdomains, since each user account has her own subdomain. In this case you have to make an additional configuration and it is to set up verification with DNS text record, as explained here http://googlewebmastercentral.blogspot.com.es/2010/03/dns-verification-ftw.html. If you don’t do this, you will be getting plenty of these error messages:

This url is not allowed for a Sitemap at this location.

Thank you to barmstrong in this forum for providing the links: https://productforums.google.com/forum/?hl=en#!msg/webmasters/w4gMRNFHMlA/24pUYqi69mkJ

If you need further help, please get in touch with me via comments.

Good luck!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s