I have a couple simple contact forms on my page. All was working well (form was sent to the email in the script) until I added this .htaccess file.
Is there a way to process the php form while also including the .htaccess file? (because it made the site look really nice)
Thanks in advance.
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
## hide .php extension
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]
## To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]
FORM CODE:
<?php
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$from = 'From: Contact Page';
$to = 'xxxx@xxx.com';
$subject = 'Contact Page';
$human = $_POST['human'];
$body = "From: $first_name
$last_name
E-Mail: $email
Phone: $phone
Message:
$message";
if ($_POST['submit'] && $human == '4') {
if (mail ($to, $subject, $body, $from)) {
header('Location: http://www.xxxxxx.com/ThankYou.php');
exit();
} else {
header('Location: http://www.xxxxxx.com/error.php');
}
} else if ($_POST['submit'] && $human != '4') {
header('Location: http://www.xxxxxx.com/error.php');;
}
?>