{"id":118643,"date":"2023-05-03T20:24:54","date_gmt":"2023-05-03T19:24:54","guid":{"rendered":"https:\/\/wpsimplefix.com\/?p=118643"},"modified":"2026-09-24T17:41:48","modified_gmt":"2026-09-24T17:41:48","slug":"preventing-wordpress-from-changing-the-htaccess-file","status":"publish","type":"post","link":"https:\/\/chkserv.com\/blog\/preventing-wordpress-from-changing-the-htaccess-file\/","title":{"rendered":"Preventing WordPress from changing the .htaccess file"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Sometimes you don&#8217;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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\t\t\t\t\t\tBefore You Continue !!<br>\n\t\t\t\t\t\tEditing any core WordPress files can be dangerous. Even a small mistake can cause major errors on your site.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Add The Code<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Simply add the following code snippet at the end of your <strong>wp-config.php<\/strong> file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-1\"><code readonly=\"true\"><xmp>add_filter('got_rewrite', '__return_false');<\/xmp><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then &#8220;Save&#8221; file. Now WordPress will no longer write to the .htaccess file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\t\t\t\t\t\tAttention !!<br>\n\t\t\t\t\t\tIf you try to change your permalink settings when .htaccess is set to read-only, then an error message will be displayed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Permalink Settings<\/h2>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/chkserv.com\/blog\/wp-content\/uploads\/2023\/05\/htaccess-error.png\" alt=\"htaccess-error\" style=\"aspect-ratio:4.30379746835443;width:680px;height:auto\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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 <strong>Settings \u226b Permalinks<\/strong> 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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes you don&#8217;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. Before You Continue !! Editing any core WordPress files can be dangerous. Even a small mistake can cause major errors [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":121200,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[114,10,115,7],"class_list":["post-118643","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-code","tag-htaccess","tag-stop","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/posts\/118643","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/comments?post=118643"}],"version-history":[{"count":1,"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/posts\/118643\/revisions"}],"predecessor-version":[{"id":136684,"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/posts\/118643\/revisions\/136684"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/media\/121200"}],"wp:attachment":[{"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/media?parent=118643"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/categories?post=118643"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chkserv.com\/blog\/wp-json\/wp\/v2\/tags?post=118643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}