Why 404 error is not reported by wp-admin during wordpress background access

Source: Internet
Author: User
Tags file permissions

A few days ago, I did not know how to perform operations on the server where wordpress is located. When I updated it today, all the menus in the background experienced error 404. This is because files are lost on the server. But I log on to the server and view all the background files. A few more links found that the wp-admin directory is not automatically added to the URL, so Error 404 is reported.

In retrospect, it seems that I changed the base of the head, but I found it in the code and I didn't find any difference. Compared with the back-end head of another wordpess station, no problem was found.

1. Check the website. htaccess file

Log on to FTP and find. htaccess file to see if any code is found to be redundant and code in a specific area is disabled. If there is any code redundant, delete it. This is the built-in standard wp template. the htaccess file only contains the following code:

# BEGIN WordPress

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

# END WordPress

File permissions in the wordpress installation directory

If the problem persists after checking the plug-in, check the permission of the installation directory as follows:

1) log on to FTP and go to/public_html/wp-admin.

2) right-click the wp-admin folder and edit the File attribute File Attributes.

3) change the folder permission to 755 and apply it to all subdirectories at the same time.

4) click OK. At the same time, set the wp-content and wp-uplodes folders as above.

5) clear cache such as browser cookies.

 

This is strange. I checked the problem on the Internet and said it was caused by nginx software url rewriting. So I tested it a few more times and finally changed it.

The rewrite rule is modified. Remove the previous rules and change the rewrite rules of wordpress under nginx:


Location /{
Index index.html index. php;
If (-f $ request_filename ){
Break;
        }
If (! -E $ request_filename ){
Rewrite./index. php last;
        }
}

I don't know whether I changed the head or the server environment caused this problem. This solution solved the problem. This rewrite rule should be the most common. Add to favorites and share it with others.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.