Apache .htaccess Generator - Server Config Tool

Generate advanced server configurations for Apache. Control directory indexing, upload limits, server signatures, and security settings via .htaccess.

General Settings

Files to load when a directory is requested

PHP Settings (Override)

Advanced Apache Configuration

Beyond simple redirects, the **.htaccess** file can control core server behaviors. This is particularly useful for overriding PHP settings on shared hosting (where you cannot access `php.ini`), such as increasing the maximum file upload size for your CMS.

Security Hardening with .htaccess

Disable Directory Browsing (`Options -Indexes`): By default, if a request hits a directory without an index file, Apache might list all the files in that folder. This is a massive security risk, exposing your file structure, backups, and images. Always disable it.

Protect Dot Files: Files starting with a dot (like `.htaccess`, `.git`, `.env`) often contain critical configuration or secrets. You should configure Apache to explicitly deny all access to these files from the web.

Server Signature: By default, error pages might show "Apache/2.4.41 (Ubuntu) Server". Disabling the ServerSignature prevents hackers from easily identifying your exact server version, making it slightly harder to target specific exploits.

PHP Override Limitations

Note that using `php_value` in .htaccess only works if your server runs PHP as an Apache module (`mod_php`). If your host uses PHP-FPM or FastCGI (common in Nginx/Apache hybrid setups), these rules might cause a 500 error. Always test one rule at a time if you aren't sure about your server setup.