I have an alias in my httpd.conf where I'm redirecting a single PHP file to another PHP file located in a different dir.

Though it appears as thought data POST'd to this file doesn't get carried along? Is that the case? If so is there a way to carry it?

I hope this is a nice simple one.

  • Do you use Redirect or mod_rewrite? First sends browser to another address and then you loose your POST data. Latter one should work fine. If it is just an Alias, then there should be no problems at all. – Cougar Apr 11 '12 at 16:07

It depends on what's going on; you mention an alias, and then you mention a redirect, but these are not the same thing.

The following says, when somebody accesses http://myurl/image, serve up the contents of /www/image. There is no redirect involved here. If a user submits POST data, it will be submitted to whatever path is specified.

Alias /image /www/image

On the other hand, Redirect (which, confusingly, also lives in mod_alias) will cause the user's browser to change to another page; using the same example as above:

Redirect /image http://myurl/www/image

So when your user accesses http://myurl/image, your server will send back a message saying, "This page has been moved to http://myurl/www/image", and your browser will resubmit the request to the new URL.

Keep in mind that you can have both an Alias and a Redirect clause on the same path, and the Redirect will take precedence--keep that in mind when looking over your rules. If you really want to see what's going on, open up a terminal and try:

curl -I http://myurl.com/image

If you see HTTP/1.1 301 (or 302) or similar, you are being redirected, and the Location field will reveal the new location. Hope this helps!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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