RewriteEngine On 
RewriteRule ^product/([0-9a-zA-Z]+) product.php?p=$1 [NC,L]
RewriteRule ^projects/?$ projects.php [NC,L]

RewriteRule ^product-detail/([0-9a-zA-Z]+) product-detail.php?p=$1 [NC,L]
RewriteRule ^product-details/([0-9a-zA-Z]+) product-details.php?p=$1 [NC,L]
RewriteRule ^project-details/([0-9a-zA-Z]+) project-details.php?p=$1 [NC,L]
RewriteRule ^blog/([0-9a-zA-Z]+) blog-details.php?p=$1 [NC,L]
RewriteRule ^new/([0-9a-zA-Z]+) news-details.php?p=$1 [NC,L]
# ------------------------------
# Custom 404 Page
# ------------------------------
ErrorDocument 404 https://techoozesolutions.in/live_dynamic/psvision/404.php
# ------------------------------
# Redirect HTTP to HTTPS
# ------------------------------
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://techoozesolutions.in/live_dynamic/psvision/$1 [R=301,L]
# ------------------------------
# Remove index.php from URLs
# ------------------------------
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+index\.php/([^\s]*) [NC]
RewriteRule ^index\.php/(.*)$ /$1 [R=301,L]
# ------------------------------
# Disable Directory Listing
# ------------------------------
Options -Indexes
# ------------------------------
# Redirect /404/ to custom page
# ------------------------------
RewriteCond %{REQUEST_URI} ^/404/$
RewriteRule ^(.*)$ /pages/errors/404.php [L]
# ------------------------------
# Security Headers
# ------------------------------
Header set Strict-Transport-Security "max-age=31536000" env=HTTPS
# ------------------------------
# Block TRACE and TRACK methods
# ------------------------------
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) [NC]
RewriteRule .* - [F]
# ------------------------------
# Block xmlrpc.php access
# ------------------------------
<Files xmlrpc.php>
  Order deny,allow
  Deny from all
</Files>

# ------------------------------
# Protect .htaccess and .htpasswd
# ------------------------------
<Files ~ "^.*\.([Hh][Tt])">
  Order allow,deny
  Deny from all
  Satisfy all
</Files>

# ------------------------------
# PHP Configuration via cPanel
# ------------------------------
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php81 .php .php8 .phtml
</IfModule>
