How to Fix WordPress Downloading Index.php Instead of Opening

How to Fix WordPress Index.php Downloads Instead of Opening

“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 reader and he wanted to know how to solve it.

As I have no idea how was this happening so I kept the question aside in my questions list until it happened with my blog.
So this made me freak out as I lost access to my wp-admin, although I have daily backup of my blog. But its not a choice to restore my blog as its a long list of work to be done and as for others they dont have daily backup.

wordpress downloading index.php

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 seems to work.
So I tried to restore my website theme to default twentyfifteen 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.

Nothing worked.
I google and found some answers like

delete AddHandler application/x-httpd-php52 .php .php5 .php4 .php3

No idea how that got there! But I got my solution.

wordpress downloading index.php

But here’s what I did and It started working within 5 minutes and it was easy.
I accessed my .htaccess in cPanel and also kept a backup incase I messed 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 and 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:

  1. Open and edit .htaccess – Have a backup before editing
  2. Delete all the codes inside it
  3. 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 because of your caching plugin or feature in your host which adds a few line of codes that makes 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.



Editorial Staff at SmartActiveBlogger is a team of WordPress experts led by Niraj Kashyap. Page maintained by Niraj Kashyap.