[英]wordpress plugin js file 403
無法從插件訪問JS文件:當前實現(實現parsley.js庫)背景:Windows 10-xampp 1.8.2-Apache 2.4,php 5.6
wp_enqueue_script( 'parsley_script', plugin_dir_url( __FILE__ ).'js/parsley.min.js');
文件存在並接收403
禁止訪問! 您無權訪問所請求的對象。 服務器對其進行了讀保護或不可讀。
錯誤日志顯示
[access_compat:error] [pid 4024:tid 2456] [客戶端127.0.0.1:62015] AH01797:服務器配置拒絕了客戶端:
服務器配置
<Directory "D:/www/htdocs/wordpress">
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
.htaccess
# BEGIN s2Member GZIP exclusions
<IfModule rewrite_module>
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} (^|\?|&)s2member_file_download\=.+ [OR]
RewriteCond %{QUERY_STRING} (^|\?|&)no-gzip\=1
RewriteRule .* - [E=no-gzip:1]
</IfModule>
# END s2Member GZIP exclusions
# 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
此類似問題在窗口框(權限) wordpress上無效-錯誤403文件javascript插件wordpress
請幫忙。 我可以將同一文件添加到theme /目錄,而不會出現403錯誤。 可以繞開它,但是背后如此瑣碎的原因卻使我難以置信。 另外,我想將腳本隔離到插件,因為它不應該依賴於主題(因為插件創建了所需的簡短代碼形式)
最簡單的事情...對於插件,我有一個.htaccess文件,該文件限制了apache僅服務png | gif文件... /plugin_dir/plugin_name/.htaccess
<FilesMatch "^(.+)\.(png|gif)$">
Allow from all
</FilesMatch>
調整為
<FilesMatch "^(.+)\.(png|gif|js|css)$">
Allow from all
</FilesMatch>
我在搜索時錯過了這么簡單的事情。 給自己(及其他)的提示-不要先尋找最復雜的答案
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.