Hello,
I would like to redirect my 2020 content to another Hugo site which is running on localhost:56735
(for example), what could be the best solution for that?
Hello,
I would like to redirect my 2020 content to another Hugo site which is running on localhost:56735
(for example), what could be the best solution for that?
–liveReloadPort 56735
Please RTFM
sorry, but that’s not what I’m trying to achieve. I want to simply redirect the 2020 content to another site. I tried externalURL
and it doesn’t seem to work.
nothing out of hugo’s box
If all runs on the same computer, create a symbolic link between the directories
in Linux use ln
In Windows use mklink
Mac ? don’t know - like Linux?
On a production server (Apache, NGINX, etc.) you would create rewrite rules (pattern matching) then redirect to the new URL while issuing a meaningful HTTP status code (typically 301).
Though discouraged, you could also use the “meta refresh” approach:
https://en.wikipedia.org/wiki/Meta_refresh
https://www.w3.org/TR/WCAG10-HTML-TECHS/#meta-element
Here’s an example that redirects the browser to another domain for every “post” on the site.
In layouts/_default/baseof.html
(or wherever you have defined the <head>
element of your pages):
{{- if eq .Type "post" -}}
<meta http-equiv="refresh" content="0; URL='https://www.example.com{{ .RelPermalink }}'" />
{{- end -}}
If you host your site on Netlify this can be easily done:
[[redirects]]
from = "/blog/2020/*"
to = "https://my-site.com/url"
status = 200
force = true
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.