Link to home
Start Free TrialLog in
Avatar of catdontdo
catdontdo

asked on

Redirecting GET as POST

I have a website that navigates via a form "POST"  (not GET)
method.  So you can't have a naked URL that drops a customer
on an item page.

When I go to do promotions it is impossible to have a
link right to a particular item

I am looking for a way (a Script ?)
That parses a regular (GET) hyperlink which contains elements
for the POST form.  

When the server receives the request it would cause the browser to
redirect using the elements provided as a POST request
as though the customer was normally navigating my site.
ASKER CERTIFIED SOLUTION
Avatar of Rob
Rob
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
While I have no doubt a router would work for this, my first instinct says it might be a little heavy-handed.  If all you need is to translate GET values into POST values, most languages can do this with a small bit of code inserted into the right place.  

What language/platform are you using for your current site?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Steve does make a good point... when using any additional framework or library you want to make sure that you're not "bloating" your site with unnecessary code.  And of course I've assumed PHP which would be a deal-breaker if you're not using it! :)

One of the main reasons I use a router is for SEO.  Being able to take GET routes and essentially do what you can with POST and vice-versa but having "friendly" urls will help your site rank well in the search engines.
I am not so sure that slim will work here.

If I understand correctly, the question is about sending a 3xx redirection back to the client in response to a GET request, that will force the client to POST and get to the real location.

As far as I know this is not how HTTP works.

The only trick that may work is dynamic construction of a POST form, using the GET query string values in hidden fields, and use setTimeout to auto-submit the form to the target location.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial