Skip to content
  • Home
  • About
  • No Access
  • Privacy Policy
Bits of .NET
Bits of .NET
  • C#
  • Asp.Net Core
  • SQL
  • Windows
  • WordPress
  • AI
  • JavaScript
  • CSS
  • MORE
    • HTML
    • Ajax
    • Git
    • Docker
    • Kubernetes
    • Photoshop
    • Visual Studio

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • C#
  • Asp.Net Core
  • SQL
  • Windows
  • WordPress
  • AI
  • JavaScript
  • CSS
  • MORE
    • HTML
    • Ajax
    • Git
    • Docker
    • Kubernetes
    • Photoshop
    • Visual Studio
Wordpress

WordPress: Recover a Site Locked Out by a Bad .htaccess File in 2 Minutes

- 30.08.26 | 31.08.26 - ErcanOPAK

📝 One Bad Line = Whole Site Down

A single malformed rule in .htaccess — from a plugin, a manual edit, or a bad copy-paste — can take down your entire WordPress site with a 500 Internal Server Error, and because it happens BEFORE WordPress even loads, the admin dashboard is unreachable too.

🔍 Why This Locks You Out Completely

.htaccess is read by Apache before PHP or WordPress ever runs.
A syntax error there causes a 500 error at the web server level -
which means wp-admin is just as broken as the front end. You
can't fix this from inside WordPress; you need direct file access.

✅ The 2-Minute Fix

  • Connect via FTP/SFTP or your host’s File Manager (cPanel/Plesk) — the WordPress dashboard itself is unreachable, so this step is mandatory.
  • Rename .htaccess to .htaccess-broken (don’t delete it yet, you may want to compare it after).
  • Reload your site — if it comes back up, the .htaccess file was the cause, confirmed.

📄 Regenerate a Clean Default .htaccess

# Once the site is back up, log into wp-admin, go to:
Settings -> Permalinks -> click "Save Changes" (no need to
change anything) - WordPress automatically regenerates a fresh,
valid .htaccess with the standard WordPress rewrite rules.

# If you had custom rules in the old file (redirects, security
# rules from a plugin), re-add them one at a time from the
# renamed .htaccess-broken backup, testing after each one.

⚠️ Prevent the Next One

  • Always download a copy of .htaccess before editing it manually or installing a plugin that modifies it.
  • Test .htaccess changes on a staging copy of the site first if your host offers one.
  • Keep a plain-text note of any custom rules you rely on, so restoring them later doesn’t require reverse-engineering a broken file.

The scariest part of a bad .htaccess is that WordPress looks completely broken when really it’s one renamed file away from working again — the fix lives entirely outside WordPress itself.

— WordPress Admin

Related posts:

WordPress: Create Custom Page Templates for Unique Layouts

WordPress: Create Custom Page Templates for Unique Layouts

WordPress: Master Database Health Check for Peak Performance

WordPress: Master Database Health Check for Peak Performance

WordPress: Fix Images That Silently Fail to Upload Because of a Hidden File Size Limit

WordPress: Fix Images That Silently Fail to Upload Because of a Hidden File Size Limit

Views: 9
Found this useful? Share it
XLinkedInWhatsApp

Post navigation

Git: Fix a Detached HEAD Before You Lose Your Last Hour of Commits
Git: Recover Uncommitted Changes After git checkout — . Wipes Your Working Directory

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Most Read

  1. 01How to make theater mode the default for Youtube 1,079 views
  2. 02How to add default value for Entity Framework migrations for DateTime and Bool 997 views
  3. 03Get the User Name and Domain Name from an Email Address in SQL 996 views
  4. 04Get the First and Last Word from a String or Sentence in SQL 873 views
  5. 05How to select distinct rows in a datatable in C# 868 views
  6. 06How to enable, disable and check if Service Broker is enabled on a database in SQL Server 671 views
  7. 07Add Constraint to SQL Table to ensure email contains @ 631 views
  8. 08Average of all values in a column that are not zero in SQL 584 views
  9. 09How to use Map Mode for Vertical Scroll Mode in Visual Studio 561 views
Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
Back to top
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com