How can Apache RewriteMod be utilized to enhance security in PHP applications?
Apache RewriteMod can be utilized to enhance security in PHP applications by blocking access to sensitive files and directories, preventing directory listing, and redirecting URLs to secure HTTPS connections. This can help protect sensitive data and prevent unauthorized access to critical files. ```apache RewriteEngine On # Block access to sensitive files RewriteRule ^config\.php$ - [F] RewriteRule ^\.htaccess$ - [F] # Prevent directory listing Options -Indexes # Redirect HTTP to HTTPS RewriteCond %{HTTPS} off RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] ```