Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

post parameters are not getting to the server after it goes through an internal redirect on apache. So www.mydomain.com would keep my post parameters, but mydomain.com doesn't. how do I fix this?

<VirtualHost *:80>
    ServerName mydomain.com
    Redirect permanent / http://www.mydomain.com/
share|improve this question

3 Answers 3

up vote 0 down vote accepted

I don't think you want to redirect in this case. The forms that they are posting from should post directly to www.mydomain.com, not mydomain.com.

You can use a ServerAlias in the specification for the www.mydomain.com to include traffic addressed to mydomain.com. You may want to do limited redirects from pages on mydomain.com to www.mydomain.com.

share|improve this answer
the problem that I use redirect is for SEO purpose, if I don't use redirect, search engine thinks mydomain.com and www.mydomain.com are two different sites. ServerAlias doesn't have this SEO benefits, any thoughts? –  user12145 Jun 2 '10 at 21:25
Use a robots.txt on mydomain.com than forbids all access. Any decently behaving crawler will then ignore the site. Exclude POST targets in the robots.txt for www.mydomain.com. You shouldn't be getting a post on an initial contact. This leads me to believe your forms think they should post to mydomain.com rather than www.mydomain.com. Check your site configuration. If you solve than then you can redirect from either configuration. –  BillThor Jun 3 '10 at 13:26

You must use the HTTP status code 307 in that case. See RFC 2616 (read 302, 303, 307). See wikipedia for a less “specificational” description.

See apache docs about Redirect for how to do this in this case.

share|improve this answer
I read through those http status code, but not sure how/which would help me. –  user12145 Jun 2 '10 at 20:02
Oh I just said “the HTTP status code” – I forgot a 307 there :-) See the linked Wikipedia article: “In contrast to 303, the request method should not be changed when reissuing the original request. For instance, a POST request must be repeated using another POST request.” –  Marian Jun 2 '10 at 22:17
Nice - worked for me –  jira Oct 9 '12 at 10:06

Keeping the post parameters depends on the client to resubmit the POST data to the new location. I am pretty sure I read in the RFC at one point in time that the clients are not supposed to do resubmit POST data after a redirect has been received.

I will update when I find the reference.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.