301 Redirect Losing POST Data

Earlier this week i implemented the forcing of trailing slashes for some websites. And this worked out great. But today one of the ladies here at the office noticed the contact form on one site wasn’t functioning properly anymore.

So i did some debugging and quickly came to the conclusion the POST data array was empty after a submit of the form. That’s weird i thought. And didn’t really have a clue where to start looking. The code wasn’t touched for a couple of weeks. Bu then i remembered adding the forcing of the trailing slash.

So i browsed to the contact form and did a view source. And there was the problem. The form submitted to


A URL without a trailing slash. This causes apache to rewrite the url to


And this also seems to turn the POST into a GET request.

So to fix it just changed to URL in the form to reflect the correct end point. But i have to say i didn’t expect this to happen. I understand why it happens. And it’s pretty logical. But i wonder if there’s a way around this behavior?

comments powered by Disqus