# ========================================================== # mwtech.live - httpdocs/.htaccess (Plain PHP + /portal/index.php) # ========================================================== Options -Indexes # ---------------------------------------------------------- # 1) Block common bot probes early (but keep /portal working) # ---------------------------------------------------------- RewriteEngine On # Block Perl probing (this causes the AH01797 logs) RewriteRule \.pl$ - [F,L] # Block CGI bin scans RewriteRule ^cgi-bin - [F,L] # Block WordPress/xmlrpc scans (if you are NOT running WordPress) RewriteRule ^wp-admin - [F,L] RewriteRule ^wp-login\.php$ - [F,L] RewriteRule ^xmlrpc\.php$ - [F,L] # IMPORTANT: Do NOT block /portal (you use it) # /portal/index.php will work normally. # ---------------------------------------------------------- # 2) Block direct access to script extensions you don't use # (Do NOT block .php) # ---------------------------------------------------------- Require all denied # Protect hidden files (e.g. .env, .git, etc.) Require all denied # Optional: block common backup/dump/log files if accidentally uploaded Require all denied # ---------------------------------------------------------- # 3) (Optional) Force HTTPS - enable if you want # ---------------------------------------------------------- # # RewriteEngine On # RewriteCond %{HTTPS} !=on # RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] # # ---------------------------------------------------------- # 4) Browser caching (your expires rules) # ---------------------------------------------------------- ExpiresActive On # Images ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType image/webp "access plus 1 year" ExpiresByType image/svg+xml "access plus 1 year" ExpiresByType image/x-icon "access plus 1 year" # Video ExpiresByType video/webm "access plus 1 year" ExpiresByType video/mp4 "access plus 1 year" ExpiresByType video/mpeg "access plus 1 year" # Fonts ExpiresByType font/ttf "access plus 1 year" ExpiresByType font/otf "access plus 1 year" ExpiresByType font/woff "access plus 1 year" ExpiresByType font/woff2 "access plus 1 year" ExpiresByType application/font-woff "access plus 1 year" ExpiresByType application/font-woff2 "access plus 1 year" # CSS, JavaScript ExpiresByType text/css "access plus 1 year" ExpiresByType text/javascript "access plus 1 year" ExpiresByType application/javascript "access plus 1 year" # Others ExpiresByType application/pdf "access plus 1 year" ExpiresByType image/vnd.microsoft.icon "access plus 1 year"