-1

I am trying to post form in core php and custom .htaccess file. When I am posting my form, it redirects to the posted page but didn't act with the php functions.

All other pages are working well dynamically, only form submission has an issue.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.werepairuae.com
RewriteRule (.*) http://werepairuae.com/$1 [R=301,L]

#form submit------------------
#RewriteRule ^([a-zA-Z0-9-/]+).php$ prob-page-dtls_post.php [QSA,L]
#RewriteRule ^([a-zA-Z0-9-/]+).php/$ prob-page-dtls_post.php [QSA,L]
RewriteRule ^([a-zA-Z0-9-/]+).php/$ prob-page-dtls_post.php    [QSA,L]
#-----------------------------

Here is my code sample, how can I fix this issue?

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Hassan
  • 11
  • 5
  • Can you post the actual form html? Are you setting the form method to post? `method="post"` – kyle Sep 25 '17 at 21:15
  • here is my html form code
    – Hassan Sep 25 '17 at 21:18
  • the same code and process i am using in other website, there its working fine .. and submitting everything .. but on this domain its not going well .. – Hassan Sep 25 '17 at 21:21
  • Please edit your question to include all relevant code. Don't post additions in comments. – M. Eriksson Sep 25 '17 at 21:23
  • Btw, what does _"but didn't act with the php functions"_ mean? – M. Eriksson Sep 25 '17 at 21:25
  • i did not get the edit option, i mean to say that when i am submitting the form, page has been redirected on there but still blank and did not work on php mail function. I am trying to email all fields which i submitted by form. – Hassan Sep 25 '17 at 21:29
  • What "edit" option? You do know that if you don't your actual code and a _proper_ description of your error, we won't have any clue about what the issue actually is, what suppose to happen or what the code looks like (and can there for not help you find where it goes wrong). – M. Eriksson Sep 25 '17 at 22:28

2 Answers2

0

You need to do the redirect differently for POST requests. Try:

RewriteRule ^([a-zA-Z0-9-/]+).php/$ prob-page-dtls_post.php [NC,P]

"Use of the [P] flag causes the request to be handled by mod_proxy, and handled via a proxy request."

Checkout these other questions for relevant discussion with redirecting POST requests:

kyle
  • 2,563
  • 6
  • 22
  • 37
  • 1
    It doesn't look like the OP actually is redirecting in that htaccess, and the url the user posts to is `prob-page-dtls_post.php`, which doesn't match the rule in the question. Since the OP has left out all code and a proper explanation about the issue, so I would say that this question can't be answered at this stage. – M. Eriksson Sep 25 '17 at 22:23
0

Thank to all of you, specially who answer me, after searching on his answer i get this one to add in my .htaccess file and i found my result. And that is i have successfully submit my form and email.

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteCond %{HTTP_HOST} ^www.werepairuae.com
RewriteRule (.*) http://werepairuae.com/$1 [R=301,L]

RewriteRule ^([a-zA-Z0-9-/]+).php/$ prob-page-dtls_post.php [QSA,L]

i Just added these 2 lines on my file

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

and it works.

Thanks to every one!

Hassan
  • 11
  • 5