Deny direct access to php files

If you have a contact form or any other form that communicates with a php file in order to send you an email etc, but you don't want that php file to be accessible directly, then the below code snippet will prevent pesky hackers from bombarding you php contact submission file:


Simply replace with you web address and make sure you have a hidden input contained in your contact form:

<form id='redirect' action='/yourPage' method='POST'>
  <input type='hidden' name='redirected', value='true' hidden>