Forum Moderators: phranque
Everything works fine except for one thing: I now get "Bad request" (error 400) spat back from Apache if I try to access the (purposely) invalid URL: http://www.example.com/article/123/This_is_an_invalid_URL_look_a_percentage_10%_and_I_know_it!
The URL http://www.example.com/article/123/This_is_a_valid_URL works and redirects as expected. Pretty much any character except for % seems to work.
First line after my RewriteEngine on in my vhost: "RewriteRule ^/article/([0-9]+)/.+$ /article/$1 [L,R=301]"
Somebody please tell me what I am doing wrong. The reason for the URL to be invalid is that it is purely used for a redirect and to show a nice address to humans. Encoding the URL is not an option because that would defeat the entire purpose of this practice. Please don't question why I am doing this. I am way too tired at this point to explain this. Please try to help me with my problem at hand instead.
It cannot be a browser/protocol-side "hard stop" error, because as mentioned, it used to work earlier.
I have tried enabling rewritelogging, but nothing is logged there or in the normal error log. Even the acces log only shows a "400" entry.
I am going crazy here and I suspect that the fix is as simple as adding some sort of [X] flag or something. Or some really obvious thing that I have overlooked.
Please help me. This is fatal to my business and it's already been broken for over 24 hours.
This is not your RewriteRule rejecting the request, this is the server rejecting the request, because it is a "Bad Request" when validated against the HTTP protocol requirements.
In other words,
http://example.com/article/123/This_is_a_valid_URL_with_a_percentage_sign_%10_and_it_should_work!
-and-
http://example.com/article/123/This_is_a_valid_URL_with_encoded_percentage_sign_10%25_and_it_will_work!
-and-
http://example.com/article/123/This_is_a_violation_of_the_HTTP_protocol_and_will_fail_100%_of_the_time!
Jim