Preventing WordPress from changing the .htaccess file

Sometimes you don’t want themes or plugins to automatically modify and write to your .htaccess file. So using a code snippet to tell WordPress not to write to the .htaccess file as a quick fix.

Add The Code

Simply add the following code snippet at the end of your wp-config.php file.

				
					add_filter('got_rewrite', '__return_false');
				
			

Then “Save” file. Now WordPress will no longer write to the .htaccess file.

Permalink Settings

htaccess-error

This lets you know that WordPress was unable to modify the .htaccess file automatically. Normally, this is what you intended. Also at the bottom of the Settings ≫ Permalinks page, you will see another error message saying that your .htaccess file is not writable. So you will need to edit the file manually, if required.

Share This

Please Donate

If my how-to tutorials helped you, please consider making a donation. ☕ ☕

chkserv

Need affordable cPanel hosting?

Leave a Reply

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