Sometimes, changes to a .htaccess file, whether manually or via a tool with appropriate access, renders a WordPress site inoperable. It might be that all pages 404, or there is simply a white screen without errors, or you get redirected to weird places, or you have the inability to login.
Whatever the case, for me, I usually take the same approach as I do with a very broken computer (or even my body for that matter). I wipe it clean and start fresh. Then I slowly add new “elements” completing a checklist each time making sure that the new element didn’t cause any grief to the overall system (to the best of my ability).
That’s what I would like to demonstrate today. I am going to clear the .htaccess file, and add the essential elements back in. Once the site is operable and you have the ability to login, at that time, it’s OK to add new elements (such as security enhancements, etc.) little by little.
Steps to Reset Your WordPress Site’s htaccess File
The steps below assume that you have FTP software (I use FileZilla) installed and that you have loaded your FTP details into the Site Manager (you can get these details from your web host, and often this is simply: host address, username, and password).
If you don’t have any FTP software or you are not familiar with FTP then you should read this tutorial to learn how to use FTP.
- Login to your server via FTP (or SFTP).
- Often you will land exactly where you need to which is the root of the server, but if you have WordPress installed in a subfolder, browse there by double clicking the folder.
- Make a backup of the existing .htaccess file. You can do that by right-clicking it, and clicking “Rename”. Perhaps add “backup” to the end of the existing file name.
- Download your backed up .htaccess file by double clicking it. Make sure you know where it lands on your computer!
- Within FileZilla, rename the downloaded file (the one on *your* computer) back to the original file name (.htaccess). That way, when you upload it after modifying it, it’ll be ready to rock.
- Open the downloaded .htaccess file in a text editor.
- Delete ALL text within it.
- Copy over the text below into your downloaded .htaccess file.
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
- Save the file.
- Head back to FileZilla, and double click the file on your computer so that it uploads back to the server. If you followed the steps above exactly, it *will not* ask you to overwrite any files, because .htaccess will not already exist on the server (because you renamed it to preserve the original, albeit broken, one).
Test. If it doesn’t work, make sure that you followed the steps above precisely, and that you copied the text exactly.
If it does work, then make your other changes one by one (starting with making one small change). Test again after the change. If it doesn’t work, it should be obvious as to why. Just backup a step.
It worked 1st time for me 10/10 nice clear info on how to fix it.
Thanks
Hey, Big thanks for that…
I am a dummy and overwrote my file, but your instructions were invaluable.
A huge THANKS!