The following column WordPress Tutorial will introduce to you the solution to automatically restore WordPress's .htaccess to the default mode. I hope it will be helpful to friends in need!
.htaccess configuration file plays an important role. But I don’t know if you have noticed that the .htaccess file of WordPress is often changed. The changes I am talking about here do not mean that the website is hacked, or that the .htaccess is changed due to the installation of plug-ins, but that the .htaccess is unknowingly changed. Restore to default.
I tested it myself. As long as you click on Settings - Fixed Connection, no matter whether you have modified anything or not, and whether you have not saved it, as long as you click "Fixed Connection", .htaccess The content between #BEGIN WordPress and #END WordPress in the file will be changed and restored automatically. I don’t know if this is a WordPress bug.
The best solution to this problem is:
Add your own statement in .htaccess and write it in # BEGIN WordPress and # END Outside WordPress, as follows:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^ index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPressRedirectRule 301 ^1.html $ 1.php
##
The above is the detailed content of Solve the problem of wordpress's .htaccess automatically restoring to the default mode. For more information, please follow other related articles on the PHP Chinese website!