As @RABI said, to encode reserved characters (such as #) into url content, you should use the correct url encoding.
The following page contains an ASCII url encoding table: https://www.w3schools.com/tags/ref_urlencode.ASP
Notice that if you want to programmatically encode strings you can use in js the function encodeURIComponent(string).
There are special characters which are reserved and not to be used as a part of a url.
The characters which may be used in a url are:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&'()*+,;=
Note it does not say where in the url they are to be used. Any other character needs to be encoded with the percent-encoding (%hh
). Each part of the URI has further restrictions about what characters need to be represented by an percent-encoded word.
Note that some of these characters for example, the hash symbol, have specific meanings, and if you want to avoid these “meanings” then you must use the percent-encoding. The way to use this programatically is by using the built-in function:
const my_hash_symbol = encodeURIComponent("#");
console.log(my_hash_symbol); // => %23
// Later, decode it if you wish
const original_symbol = decodeURIComponent("%23");
console.log(original_symbol); // => #
Edit: The “meaning” of the hash-symbol (“#”) results in the browser looking for a file named KM_72
instead of the full KM_72#050#500.svg
, which of course does not exist.
The ‘#’ character falls into the category of “delims”:
delims = "<" | ">" | "#" | "%" | <">
which does not cause a crash or error (directly), but does change the behaviour of the browser’s file searching mechanism which results in a non-direct 404 error.
I have a lot of images with a url like this one:
KM_72#050#500.svg
When I will open the image in my Laravel application, the server response is 404.
If I change the file name to KM_72-050-500.svg
it works. It means, that the path is ok.
The images are from a customer. So, I like to use themes with the original name.
Is there a possibility to change the url to cover the #
?