About .htaccess Files
The .htaccess (hypertext access) file is a configuration file for use on web servers running the Apache Web Server software.
Common uses:
- URL rewriting (clean URLs, redirects)
- Custom error pages (404, 500, etc.)
- Password protection for directories
- Blocking IP addresses or user agents
- Setting MIME types
- Enabling CORS headers
Important notes:
- Only works on Apache servers (not Nginx, IIS, etc.)
- Changes take effect immediately (no server restart needed)
- Incorrect rules can break your website
- For security, avoid exposing .htpasswd files
- For performance, consider moving rules to main server config