0

Are POST variables accessible to mod_rewrite? I am trying to determine whether or not it is possible to perform a redirect with Apache2.2 and mod_rewrite where the rewrite rule considers the POST variables associated with a request, and uses these values to inform the final destination.

e7zkw9120
  • 173
  • 3
  • 8

1 Answers1

2

No.

One of the reasons we have HTTP-POST is to keep application data out of the URL. So using something that by its definition reformats URLs to try to access that data won't work.

mod_rewrite is for turning

www.foo.com/index.php?uglyparameter=bar

into

www.foo.com/bar

So the user doesn't have to hurt their eyes on an ugly URL. Other uses here: Apache Mod Rewrite Guide

bpoetz
  • 36
  • 4
  • thanks. im actually trying to make a high level decision about where to send the request, based on the content of the post data, but i guess this is not the way to do it. – e7zkw9120 Sep 26 '09 at 13:17
  • If you have your heart set on routing traffic based on form input, you can use javascript to change the client-side form elements action property on submit. I recommend against this, as it goes against what I mentioned in my first answer. It just makes the most sense to handle an HTTP POST request on the server. – bpoetz Sep 27 '09 at 15:00