2

Is there a way I can change the HTTP Request Method from POST to GET using apache modules such as mod_rewrite or 3rd party module ?

The reason I'm doing this is to minimize server side changes as I'm doing this for a demo.

2
  • If you are talking about mod_rewrite. This is a server side change. Also, not all POST requests can be changed to GET. The URL has a maximum allowed length. For example, this is not possible if you posting files.
    – Khaled
    Dec 5, 2011 at 15:21
  • no the POST data will be zero. so no problem with max allowed length. I just want to change the request method from POST to GET from apache config if possible
    – Lydon Ch
    Dec 5, 2011 at 15:28

1 Answer 1

0

You could simply issue a 302 (temporary) redirect to the same URL and the browser will automatically change the request to GET. Naturally any POST data will be lost, but you say there is no POST data.

You could use the following in the Apache config (or .htaccess):

RewriteEngine On

RewriteCond %{REQUEST_METHOD} =POST
RewriteRule ^/?url-to-change-post-to-get$ %{REQUEST_URI} [R=302,L]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .