This question is very similar to: Is it possible to redirect post data? (asked eariler) but that answer does not seem to work for me.
I have a form:
<form action="http://a.test.com/contact" name="contact" method="post">
and inside of a add-on domain, (test.com is an addon), there is a subdomain (a.), and inside of there I have a file item.php, and .htaccess
my htaccess is as follows:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^/]+)/$ $1.php
# Forces a trailing slash to be added
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
#normal rewrites
RewriteRule ^[~|-]?([a-zA-Z0-9]+)[/]*$ item.php?user=$1 [NC,L]
note: I left it as [NC,L] because when I changed it to [NC,P] it gives me a 500 server error.
and my item.php
<?php
echo "<pre>";
print_r($_POST);
echo "</pre>";
and no matter what the form contains, the $_POST is blank... however, if I do http://a.test.com/item.php?user=contact as the action.
all goes well. POSTing skips the htaccess, and the solution on SO doesn't seem to work.
Thanks in advance
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…