错误403 - 我无法再在WP上安装插件



在admin.php上的脚本中有一个错误,我修复了它并检查了所有权限是否正确设置。从那时起,我无法在我的WP中安装插件。我迷路了-有人能帮帮我吗?

我的主机告诉我服务器没有问题

我想安装一个插件,但我有错误403

我的当前脚本admin.php如下和权限755

<?php
/**
* WordPress Administration Bootstrap
*/
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', dirname( __FILE__ ) . '/' );
}
require_once ABSPATH . 'wp-load.php';
// If the user is not an administrator, do not proceed
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
}
// Add necessary scripts and styles
add_action( 'admin_enqueue_scripts', 'my_admin_scripts' );
function my_admin_scripts() {
wp_enqueue_style( 'wp-admin' );
wp_enqueue_script( 'common' );
wp_enqueue_script( 'wp-lists' );
wp_enqueue_script( 'postbox' );
wp_enqueue_script( 'jquery-ui-dialog' );
}
// Allow administrators to install and activate plugins
define( 'FS_METHOD', 'direct' );
define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) );
define( 'FS_CHMOD_FILE', ( 0644 & ~ umask() ) );
define( 'FS_CONNECT_TIMEOUT', 30 );
define( 'FS_TIMEOUT', 30 );
// Disable automatic updates
define( 'AUTOMATIC_UPDATER_DISABLED', true );
// Allow all file types to be uploaded
add_filter( 'upload_mimes', 'my_custom_upload_mimes' );
function my_custom_upload_mimes( $mime_types ) {
$mime_types['svg'] = 'image/svg+xml';
$mime_types['webp'] = 'image/webp';
return $mime_types;
}

和。htaccess脚本在下面,权限设置为644:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>
<FilesMatch ".*.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|suspected)$">
Order Allow,Deny
Deny from all
</FilesMatch>
<FilesMatch "^(index.php|wp-login.php|profile.php|load-styles.php|load-scripts.php|plugins.php|plugin-install.php|wp-head.php|wp-site.php)$">
Order Allow,Deny
Allow from all
</FilesMatch> 

这个问题可以在你的htaccess文件中找到。

<FilesMatch ".*.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|suspected)$">
Order Allow,Deny
Deny from all
</FilesMatch>

表示应该拒绝对所有扩展名为括号中的文件的访问。因此,删除该块,一切都应该正常

最新更新