How to set HTTPS in sitemap

1,217 views
Skip to first unread message

Lucas Simon Rodrigues Magalhaes

unread,
Mar 10, 2017, 7:07:09 AM3/10/17
to Wagtail support
Hello everyone,

How can I set the HTTPS protocol in my sitemap.xml [1].

In admin I defined two sites:

1. devtir.com.br, port 80
2. devtir.com.br, port 443 default

But the sitemap generate only http://

Matthew Westcott

unread,
Mar 10, 2017, 7:28:30 AM3/10/17
to wag...@googlegroups.com
Hi Lucas,
I'd suggest removing the port 80 site record - it's not necessary. If Wagtail can't find a site that matches the current request by hostname and port, it will fall back on one that matches by hostname only - so it'll still match the port 443 record, even if the request is arriving on port 80.

This way, Wagtail will always use https:// when generating a full URL for a page. (If you want it to show up as http:// instead when accessing the sitemap over HTTP, that's not possible: a page must always have one canonical full URL, it can't change in different contexts.)

Cheers,
- Matt

Lucas Simon Rodrigues Magalhaes

unread,
Mar 10, 2017, 7:58:52 AM3/10/17
to Wagtail support
Thanks Matthew,

Another question, I have a cname www in DNS. So, I should create another record with www in hostname  field?

Matthew Westcott

unread,
Mar 10, 2017, 8:32:33 AM3/10/17
to wag...@googlegroups.com
That'll give you a similar problem - you won't be able to control whether the www or non-www version is used as the full URL. A better idea would be to set up a redirect from www to non-www (or vice versa) at the web server level - I believe that will also help with SEO, as it means you're not serving the same content from two different places.

Cheers,
- Matt
> --
> You received this message because you are subscribed to the Google Groups "Wagtail support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to wagtail+u...@googlegroups.com.
> To post to this group, send email to wag...@googlegroups.com.
> Visit this group at https://groups.google.com/group/wagtail.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/wagtail/fec1eacd-7c92-4251-a67d-78228ac31c09%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Lucas Simon Rodrigues Magalhaes

unread,
Mar 10, 2017, 8:59:10 AM3/10/17
to Wagtail support
Thank you Matthew, you solved my doubts.

I do the 80 port redirect to 443 in nginx, so I'm on the right path. Now I'm going to follow Google Search Console and SEO results

[] 's

Lucas Simon
Reply all
Reply to author
Forward
0 new messages