Reputation: 23
The address of the contact form of my website is
www.mysite.com/contact
and the actual contact form address is www.mysite.com/contact.php
When the user fills the contact form, i want contact.php to receive the post data coming from "/contact". I created a folder named contact and put a .htaccess file with the content below
RewriteRule (.*) /contact.php
But the post data is lost after the form is submitted and /contact is redirected to contact.php. Any ideas to solve it?
Upvotes: 2
Views: 1730
Reputation: 143966
contact
directory. Put this rule in the htaccess file in your document root
RewriteRule ^contact/?$ /contact.php [L]
The reason why you are losing your POST data and getting redirected is because if there is a contact
directory, and you request /contact
, the mod_dir module will redirect you to /contact/
to enforce trailing slashes for requests to directories. The redirect and the rewrite both get applied and thus you see /contact.php
.
Upvotes: 1