Webpage with ampersand in its name suddenly stopped loading ("bad request")

109 Views Asked by At

My boss has tasked me with remaking his business website from the ground up. I'm pretty new to web design and am learning as I go. Our webhost created a WordPress staging site that I can work on while the original site stays up and running. Recently we've encountered a real problem: a very important page on our original (current) website has a filename that includes an ampersand. It loaded perfectly for customers for over a decade, but now suddenly refuses to load, returning a "bad request" error message for any browser we've tried. The page's URL is in this format:

www.example.com/Gems&Rocks.htm

I changed all instances of '&' to 'n' in the HTML code as well as the file names associated with it, and that got the page working again. Problem is, there are hundreds of other pages across the internet that backlink to this important page under its original name. My boss is adamant that I find a way to get the original filename with the ampersand in there so we don't lose business. He thinks this is all my fault, but I did absolutely nothing to change the old website. The webhost's tech tells me he can't do anything about it, and that this emergent problem wasn't caused by anything he did because he hasn't changed anything on the webserver in over a year. He says the '&' is a reserved character and shouldn't have been in the pathname anyway. Nevertheless, our page loaded just fine for many years.

Searching the web has done me no good, it's like I'm the only person in the world who has encountered this problem. But surely someone else has had such a thing happen. So I guess my specific questions are:

  1. Did pages with '&' in their name suddenly stop loading for everyone or just our website?
  2. Is there a way to "trick" our website into loading the page instead of deciding the '&' is a "bad request"?
  3. Can a URL redirector be set up that sends users from "Gems&Rocks.htm" to GemsnRocks.htm?
1

There are 1 best solutions below

3
Stephen Ostermiller On

The "bad request" error comes from your web host's server. If it worked previously, but now shows that error, then something MUST have changed on the server.

It is possible that you might be able to redirect that request. You don't say what server your web host is using. It's likely to be some version of Apache and you probably have .htaccess configuration available to you. One option might be to put something like this in your .htaccess file:

RedirectMatch 301 ^/Gems\&Rocks\.htm$ https://example.com/GemsnRocks.htm

Whether or not that works will depend on the server that you are running on and how it is configured.