I hate adding a bunch of stuff to my .htaccess file, but I had to take care of a page on this site that has had its address changed and everyone trying to visit it gets a 404 error.

I know that addresses shouldn't change, but part of the way that I set up TYPO3 the way that I do it resulted in a few links being broken. One of those links was one of the most visited pages on this site - the page about how to restart webmin.

Although I have a sitemap that has been submitted to Google, Google still keeps showing the old url to the above page instead of the new url. I'm surprised the page still even shows up in search results when everyone who visits it gets a 404 error.

Anyway, here's how I fixed the problem with a 301 redirect with .htaccess.

I just added the following line to the top of my .htaccess file:

Redirect 301 /how-to-restart-webmin-a https://www.netdip.com/2017/how-to-restart-webmin

And what you see there on that line is the instruction "Redirect 301" which sends a signal back to the visitor's browser and tells it that if they're trying to visit "/how-to-restart-webmin-a", which was the old URL, that it should direct itself to the new URL at "https://www.netdip.com/2017/how-to-restart-webmin". 

It's really very simple how it works and there's no need to restart the webserver for it to take effect. 

301 vs 302 redirect?

Perhaps you wonder why I used a 301 redirect? Why not a 302? The "301" tells the web browser (or whatever client is trying to visit the redirected page) that the redirect is permanent.

If a temporary redirect is needed, all that would need to be changed in the above example would be changing the "301" to "302".