Jump to content

Change canonical links according to domain on nginx.

Dany Day

Recommended Posts


The company I currently work for has 2 websites. It so happened that they have different domains A and B, but the same content. In fact, this is the documentation for mkdocks. Both domains access the same project built using mkdocks.yml, in which domain A is specified.

Task: fix the canonical links of site B, because they are now being built with domain A due to the data in mkdocks.yml.

Simple solution: create a second mkdocks_2.yml specify domain B in it and raise the second copy of the documentation. And let one of the sites link to it.

However, I'm interested in the question, is it possible to do this through the nginx web server parameters? So that the domain in canonical links changes depending on the domain from which the request comes? This will avoid making another instance of the docks on the server.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...