“WordPress downloads a compressed file instead of opening index.php or when i try to access my wp-admin”.
This was a question asked to us by one of our readers and he wanted to know how to solve it.
As I had no idea how was this happening I kept the question aside in my questions list until it happened with my blog.
This made me freak out as I lost access to my wp-admin, although I have a daily backup of my blog. But it’s not a choice to restore my blog as it’s a long list of work to be done and as for others, they don’t have a daily backup.
So just like a normal user I deactivated all my plugins through the backend of my hosting and tried to access the wp-admin, But this didn’t seem to work.
So I tried to restore my website theme to default twenty fifteen but this time too, I was out of luck and now I was worried.
I worked fine on my website all day yesterday, but this morning it tried to download the index.php instead of opening it like a browser normally does.
Now as I know I have tried:
- Renaming my theme to old-[name-of-theme]
- Renaming plugin folder to old-plugins (to disable them all)
- Clearing the cache for Firefox, Safari, and Chrome.
I Googled and found some answers like
No idea how that got there! But I got my solution.
Method to Fix WordPress Downloading Index.php
But here’s what I did It started working within 5 minutes and it was easy.
I accessed my .htaccess in cPanel and also kept a backup in case I messed up the config codes. (Please Keep a backup).
If for any reason you can’t find .htaccess on your WordPress installation root directory, then Click File Manager make sure to tick Show Hidden Files (dotfiles), and click Go.
The .htaccess should show up where wp (wp-admin, wp-content, wp-includes) is installed, which is your WordPress root directory.
I studied the code and I found some extra lines of code messing with my WordPress. I deleted the extra code and it started working.
For those who are not programmers for them follow the steps below:
- Open and edit .htaccess – Have a backup before editing
- Delete all the codes inside it
- Now copy the code below this and paste & save it
- It should be working now, you can access your WordPress admin.
Hope this helps someone, and have a great day!!!
The reason why your index.php is downloaded is that of your caching plugin or feature in your host which adds a few lines of codes that make your WordPress fast as it compresses the file but in some cases, wp-admin is also cached which makes it impossible to access.
So just edit your .htaccess and paste the above code given and your blog is again ready to rock
If you have any queries, feel free to ask below in the comments.