Without seeing your code, it's difficult to say what your issue really is, but I suspect what's happening here is a misunderstanding.
%20
is not a literal string, and you shouldn't try to treat it as one. %XX
in URLs, where XX are two hexadecimal characters, is a URL encoded string. Values that aren't URL-safe (which is... pretty much anything other than basic US-ASCII) are encoded in this fashion so that they become URL-safe. The US-ASCII codepoint for a space is 20, so it gets encoded as %20
. When you see %20
in a URL, you're actually dealing with a space, not a literal percent character, a two, and a zero.
Hence, if you try to replace this value with something else by doing this:
str_replace("%20", "", $url)
that won't work, because you're replacing the literal string not the real value. Try this instead:
str_replace(" ", "", $url)