I have the sitemap of www.mysite.com hosted on https://s3.amazonaws.com/mysite/sitemaps/sitemap1.xml.gz
Is it possible to configure Rails (routes, controllers, ...) to render the file sitemap1.xml under www.mysite.com/sitemap1.xml.gz?
Thanks.
Ps. the reason why the sitemap is under AWS is this: https://github.com/kjvarga/sitemap_generator/wiki/Generate-Sitemaps-on-read-only-filesystems-like-Heroku
based on https://github.com/kjvarga/sitemap_generator/issues/173
I'm trying this...
in routes.rb
get 'sitemap(:id).:format.:compression' => 'sitemap#show'
in sitemap_controller.rb
class SitemapController < ApplicationController
def show
data = open("http://{ENV['AWS_BUCKET_PROD']}.s3.amazonaws.com/sitemaps/sitemap#{params[:id]}.xml.gz")
send_data data.read, :type => data.content_type
end
end
Also make sure that sitemap (index) file contains links to other sitemap files (sitemap1, sitemap2...) located at your site and not amazon.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With