Your browser sent a request that this server could not understand.
The request line contained invalid characters following the protocol string.
How can I make the server understand the space character through mod_rewrite? I really want to get space characters to work to allow my visitors (mostly kids) to directly enter a name without worrying about any special characters to type instead of spaces (plus signs or underscores, for example).
Gee, you STILL haven’t read the tutorial in my signature, have you. This very subject (spaces in the {REQUEST_URI} and how to get around them) is covered.
Moreover, you MUST know that a space is FORBIDDEN in a URL - PERIOD! Slide on over to w3.org for confirmation of that - that’s why your space is replaced by %20 (hex for the space character).
Now, have your visitors enter their desired URL in a textbox and convert it before submitting and you should be okay (when you get it back as a string) OR have mod_rewrite convert it for you (bad idea - PHP is much more efficient at character manipulation).
Sorry, I must have overlooked that while reading the article (I did read it though ). Could you please direct me to the section that talks about this issue?
So, suppose I DO want spaces (being plain stupid and ignoring the fact that spaces are illegal in URLs) since I expect that visitors may directly type the URL. How would I prevent that 400 Error? It seems that there’s something with mod_rewrite that prevents the spaces, while directly entering the query string in the URL allows it. I just want to see how this works. I really appreciate all your help and apologize for asking about this so many times.
The ban on spaces is enforced by all browsers as they will convert every space to %20 before sending the request via the http protocol.
You CAN access a space in mod_rewrite but ONLY within a character range definition by an escaped space, i.e., [\_] (where the _ is a space).
A query string created by a form will have replaced its spaces with +'s so, your regex could use code similar to the newly added section: Replace A Character: