簡體   English   中英

Wordpress 媒體文件上傳 403 禁止

[英]Wordpress media file upload 403 forbidden

我正在嘗試在 wordpress 中上傳文件,但我收到了禁止某些文件的 http 錯誤 403。 圖像具有相同的分辨率,大小幾乎沒有任何不同,並且 mime 類型相同。

我在 php 7.0 中使用 apache2,但是這個問題似乎在具有不同 php 版本的多台服務器上持續存在。

php.ini 設置

upload_max_filesize = 512M
post_max_size = 128M

我什至嘗試將它添加到 .htaccess

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
        RewriteRule ^index\.php$ - [L]

        RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

        # add a trailing slash to /wp-admin
        RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

        RewriteCond %{REQUEST_FILENAME} -f [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^ - [L]
        RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
        RewriteRule ^(.*\.php)$ $1 [L]
        RewriteRule . index.php [L]
</IfModule>

php_value upload_max_filesize 512M
php_value post_max_size 512M
php_value memory_limit 512M

我沒有使用 mod_security,所以上傳限制在這里不適用。 這是 apachectl -M 的輸出:

Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 filter_module (shared)
 mime_module (shared)
 mpm_prefork_module (shared)
 negotiation_module (shared)
 php7_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 status_module (shared)

似乎是由於防火牆設置,系統管理員嘗試停用“協議違規”並開始正常工作。

我認為您應該檢查上傳文件夾的文件夾權限。 來源: https : //codex.wordpress.org/Changing_File_Permissions

僅將以下代碼添加到 yours.htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

希望它對你有用

我只是有同樣的問題。 我試圖直接在我帖子的編輯器視圖中上傳圖片。 我想我打開它的時間太長(超過 24 小時)並且一些令牌或其他東西過期了。 重新加載編輯器后,它再次正常工作

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM