Economicalhost · Knowledge Base
Knowledge Base › Files & Backups › How to Edit Your .htaccess File
Files & Backups

How to Edit Your .htaccess File

.htaccess controls redirects, caching, security and URL rules. It is powerful — and a single bad line causes a 500 error — so edit it carefully.

Step-by-step

  1. Open Files → File Manager and click Settings → tick "Show Hidden Files (dotfiles)" → Save.
  2. Go to public_html and locate .htaccess (create a new file named .htaccess if none exists).
  3. Back it up first — right-click → Copy to .htaccess-backup.
  4. Right-click → Edit to open it.
  5. Add or change rules — e.g. redirects, Gzip, or caching — keeping each directive on its own line.
  6. Save and test immediately. If you get a 500 error, restore the backup.

💡 Good to know

  • Always keep a known-good backup before editing — recovery is then instant.
  • WordPress regenerates its core .htaccess rules when you re-save Permalinks.
  • Order matters in .htaccess — redirect and rewrite rules are processed top to bottom.