Reset the .htaccess File to Troubleshoot WordPress PHP Errors

While installing a theme or plugin on your WordPress site, you may encounter a confusing error message— according to the error, your PHP version is out of date. When you check your PHP version in cPanel’s MultiPHP Manager, it looks like you’re using the latest available! Usually this is just a simple coding error in the site’s .htaccess file. Let’s take a look at how to resolve this WordPress PHP error.

Use cPanel to help manage your sites with our Shared Business Hosting!

Deactivate Old Files

First, let’s head to cPanel’s File Manager and deactivate that troublesome .htaccess file. Go to the directory containing the WordPress site you are troubleshooting. If you can’t see the .htaccess file, be sure that you are able to view hidden files. We aren’t going to delete the file— instead we will rename it. That way you will still have it for reference if you need to reconfigure a plugin or theme!

For tips on using the File Manager for a variety of tasks, take a look at our guide to using File Manager in cPanel!

You can deactivate the file by simply adding an extension that cPanel won’t recognize to the end. .bak is a popular choice in cPanel and Apache since it reminds the user that the file is a backup. I’d also suggest adding the current date to the end of your renamed file. This makes things much easier if you ever have to go through the files later. You’ll have a hard time remembering the difference between .htaccess1.bak and .htaccess2.bak, but will easily be able to tell .htaccess03042019.bak and .htaccess09082019.bak apart!

Add a Default .htaccess File

WordPress requires a properly coded .htaccess file to run, so your site won’t be back up until we put one back on the server. Just make a new file named .htaccess and put the following code inside of it:

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Next Steps: Reactivate and Rebuild

If setting your WordPress site’s .htaccess to a default file did not resolve the issue, you will need to check some other files. Try troubleshooting your site’s php.ini file and the wp-config.php file. These files can also contain code that overrides your PHP settings. As always, make backup copies of each before you delete anything!

If you were trying to update WordPress or a plugin, you should be able to do so now. Once everything is up to date, you’ll probably want to deactivate and reactivate your plugins one by one. Many plugins add code to the .htaccess file as part of their installation— reactivating the plugins should put any necessary code back in the .htaccess file. Do this one at a time so that you’ll be able to tell if one plugin in particular causes an error.

For simpler sites, plugin reactivation should be more than enough. If you’re using plugins that put a great deal of custom code in the .htaccess file, you may need to open the old version of the .htaccess in cPanel’s file manager and copy the relevant code over to your new .htaccess.

Learn more WordPress tips and tricks at InMotion Hosting’s WordPress Education Channel!

Thoughts on “Reset the .htaccess File to Troubleshoot WordPress PHP Errors

  • How can I use htaccess file to rewrite this address without error /index.php?p=blogs/viewstory/181 it my social media network site called pclasp I have tried all I could but is not working out each time I add the rewrite code into htaccess file I can’t login again as an admin why I need help please

    • Hi Innocent,

      I recommend contacting Technical Support for direct assistance with this issue.

      Best Regards,
      Alyssa K.

    • Hello Innocent,

      Thank you for your question. I recommend contacting a developer that is experienced in whatever software you are using to build your site.

      Best Regards,
      Alyssa K.

Was this article helpful? Let us know!