OpenBSD httpd: How to redirect from .html-URLs to non-.html-URLs
Contents
Problem
After switching to a new website generator, all pages had moved from .html- to non-.html-URLs.
If Google found my site, the old .html-urls were linked:
Clicking a link would refer to 404 - not found
.
Solution
To redirect from the non-existing-.html-urls to the new non-.html-urls, I had to add:
|
|
to /etc/httpd.conf
.
301 tells search engines, that the page has permanently moved, so they will update their search indexes accordingly.
Perform
|
|
to check httpd’s configuration and restart httpd.
Caution
This is no solution if you just want to cut off the .html-extension from urls: If your url is
/my-page.html
, this would redirect to /my-page/
and your website would return 404 - not found
. For simple redirecting - when pages doesn’t have moved - you would rather use request rewrite.