Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

www.councilclimatescorecards.uk/* should redirect to councilclimatescorecards.uk/* #695

Open
zarino opened this issue Oct 8, 2024 · 2 comments

Comments

@zarino
Copy link
Member

zarino commented Oct 8, 2024

We already have canonical tags on https://www.councilclimatescorecards.uk pages, pointing to their https://councilclimatescorecards.uk equivalents, which should mean that search engines don’t see the sites as duplicates.

But Isaac wondered whether, if it’s not too much bother, we should just set up a 301 redirect from every https://www.councilclimatescorecards.uk/* page to its https://councilclimatescorecards.uk/* equivalent?

Is there any reason not to do this? /cc @struan @sagepe

(We seem to have non-www to www redirects set up for our other services—eg LIH, TWFY, FMS—so I guess councilclimatescorecards would be the same but in the opposite direction, sending people from www to non-www.)

@struan
Copy link
Member

struan commented Dec 17, 2024

This is made more complex because councilclimatescorecards.uk and cape.mysociety.org are served from the same vhost. The redirect mechanism we use on other sites is present here in that it will redirect previous URLs (e.g caps.mysociety.org) but it redirects them to the default host name which is cape.mysociety.org.

I think for this to work we probably need to do something clever in the http.conf.

FWIW, this used to work when this was all hosted in a docker container.

I think this should work:

RewriteCond %{HTTP_HOST} ^www.councilclimatescorecards.uk$ [NC]
RewriteRule ^/(.*)$ https://councilclimatescorecards.uk/$1 [R=301,L]

@sagepe
Copy link
Member

sagepe commented Dec 17, 2024

Are you happy to have a go at that @struan or do you want me to look at it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants