So I have gotten to the point where I am unhappy with how I have structured some of my site, and I am considering an overhaul to my websites structure.
Anyway, does anyone know if there is a way to alias old URLs on a static site, so that I don’t break the links of anyone who might’ve linked to me?
I have a few hundred redirects on my static site, but I define them in my .htaccess file. If you’re on Neocities you’ll need a meta refresh tag.
2 Likes
Ah, that’s probably what I need! I’ll look into it properly. I’m on GitHub Pages rather than Neocities, but I assume it will be close enough for this case
Static sites don’t work with .htaccess
— the best way to have a redirect on a completely static site is using <meta http-equiv=refresh>
. (The MDN page I linked gives an accessibility warning for short refresh times but if I recall correctly that’s for short nonzero times.)
It also helps to have a visible <a>
redirect on the same page as the <meta>
, in the event a user has <meta>
redirects disabled for any reason.
Edit: Ah wait meta refresh was already mentioned in an earlier reply; whoops
I disagree. I’ve got a bunch of redirects set up for my static site in .htaccess
and they work just fine.
# directory redirects
Redirect 301 /assets/artwork/ /assets/images/
Redirect 301 /assets/buttons/ /assets/images/
Redirect 301 /blog/reality-where-html-never-existed/ /grimoire/entries/reality-where-html-never-existed/
Redirect 301 /blog/catherine-lucille-moore-queen-pulps/ /grimoire/entries/catherine-lucille-moore-queen-pulps/
Redirect 301 /blog/entertainment/ /grimoire/entries/
Redirect 301 /blog/lewd/ /grimoire/entries/
Redirect 301 /blog/links/ /grimoire/entries/
Redirect 301 /blog/misc/ /grimoire/entries/
Redirect 301 /blog/personal/ /grimoire/entries/
Redirect 301 /blog/rant/ /grimoire/entries/
Redirect 301 /blog/rants/ /grimoire/entries/
Redirect 301 /blog/tech/ /grimoire/entries/
Redirect 301 /blog/writing/ /grimoire/entries/
Redirect 301 /feeds/ /follow/
Redirect 301 /grimoire/emacs/ /grimoire/old/emacs/
Redirect 301 /grimoire/listening/ /grimoire/old/listening/
Redirect 301 /grimoire/playing/ /grimoire/old/playing/
Redirect 301 /grimoire/reading/ /grimoire/old/reading/
Redirect 301 /grimoire/surfing/ /grimoire/old/surfing/
Redirect 301 /grimoire/thinking/ /grimoire/old/thinking/
Redirect 301 /grimoire/webcraft/ /grimoire/old/webcraft/
Redirect 301 /grimoire/writing/ /grimoire/old/writing/
Redirect 301 /media/ /assets/images/
# fiction redirects
Redirect 301 /fiction/stories/milgram-battery/ /grimoire/entries/the-milgram-battery/
# file redirects
Redirect 301 /feed.xml /follow/everything.xml
Redirect 301 /headlines.xml /follow/headlines.xml
Redirect 301 /follow/everything.json /follow/everything.xml
Redirect 301 /follow/headlines.json /follow/headlines.xml
Redirect 301 /.well-known/avatar /assets/images/author.jpg
Redirect 301 /grimoire/entries/nine-𝑥-to-know-me/ /grimoire/entries/nine-x-to-know-me/
However, I run my site on Nearly Free Speech, which allows me to use .htaccess
. If you’re on a host like Neocities or Nekoweb then you don’t have that access, and must use meta tags in individual pages.
1 Like