Skip to content

Commit

Permalink
Add PHP handling and access restrictions for contact.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Web-Jose committed Feb 2, 2024
1 parent 210f31b commit 4d9bfb2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
ErrorDocument 404 /404.html

<Files "contact.php">
# Ensure that the PHP file is being handled by the PHP handler, this is usually the default
SetHandler application/x-httpd-php

# Optionally, ensure that the PHP file can only be accessed via your website's form
Order Deny,Allow # Deny all, then allow from specific domain
Deny from all # Deny all
Allow from codebyjose.com # Allow from specific domain
</Files>

# If using mod_rewrite to rewrite URLs, ensure it's not interfering with access to contact.php
<IfModule mod_rewrite.c>
RewriteEngine On
# Exclude contact.php from being rewritten
RewriteCond %{REQUEST_FILENAME} !-f # If the request is not for a file
RewriteCond %{REQUEST_FILENAME} !-d # If the request is not for a directory
RewriteCond %{REQUEST_URI} !^/contact\.php$ # If the request is not for contact.php
</IfModule>

0 comments on commit 4d9bfb2

Please sign in to comment.