为什么在我的本地环境这项工作,但404对我的生产服务器上运行的cPanel:为什么我的文件在我的本地环境中找到,但在我的cpanel服务器上是404?
$adminDir = get_bloginfo('template_directory');
$adminDir = $adminDir."/lib/admin/";
$preview_file = $adminDir.'functions/live_preview.php';
wp_register_script('admin', $adminDir."js/admin.js", false, '1.0'); //register script
$wp_paths = array('template_url' => $adminDir.'functions/live_preview.php');
wp_localize_script('admin', 'object_name', $wp_paths);
wp_enqueue_script("admin");
林不知道提供什么其他信息,本地进出口运行Ubuntu和Apache,我知道我的生产环境用apache运行一些linux的风味。我有一些JS发送一个Ajax请求的页面有问题与:
$.ajax({
url: object_name.template_url,
type: 'POST',
data: { data: data },
success: function(result) {
kjd_reload_styles();
}
});
我得到我的当地环境没有错误,但在生产了404我的Ajax响应结果。这是为什么?
BUMP - 所以有问题的文件是:
http://sandbox.kylejenningsdesign.com/wp-content/themes/bootstrappedWP/lib/admin/functions/live_preview.php
试图击中失败为404,但如果你去到它的父目录:
http://sandbox.kylejenningsdesign.com/wp-content/themes/bootstrappedWP/lib/admin/functions
你可以看到上市的文件(顺便说一句,其中所有的404)。那是怎么回事?
这里是我的.htaccess文件,它看起来像标准的WordPress的.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
添加错误日志:
,从我的cPanel的错误日志去了,这里是我发现了什么。有两种类型的日志,一种显示最近的300个日志,然后是更深入的日志。 基本只记录显示这个(事实上,这个错误现在出现了后,我的AJAX CAL行动)
[Sat Apr 19 18:30:43 2014] [error] [client 76.100.35.2] SoftException in Application.cpp:629: Directory "/home/kylejenn/public_html/sandbox/wp-content/themes/bootstrappedWP/lib" is writeable by group, referer: http://sandbox.kylejenningsdesign.com/wp-admin/admin.php?page=kjd_header_settings
un Apr 20 15:31:49 2014] [error] [client 173.71.202.111] SoftException in Application.cpp:629: Directory "/home/kylejenn/public_html/sandbox/wp-content/themes/bootstrappedWP/lib" is writeable by group, referer: http://sandbox.kylejenningsdesign.com/wp-admin/admin.php?page=kjd_body_settings
**The in depth error logs show:**
[18-Apr-2014 15:15:36 UTC] WordPress database error MySQL server has gone away for query SELECT option_value FROM wp_options WHERE option_name = '_transient_doing_cron' LIMIT 1 made by _get_cron_lock
[19-Apr-2014 20:04:48 UTC] WordPress database error Unknown column 'z6p9z9mlt_posts.post_type' in 'where clause' for query SELECT z6p9z9mlt_comments.* FROM z6p9z9mlt_comments WHERE comment_post_ID = '206' AND comment_approved = '1' AND z6p9z9mlt_posts.post_type NOT IN('project', 'task_list', 'task', 'milestone', 'message') ORDER BY comment_date_gmt DESC LIMIT 10 made by require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts
是什么'object_name.template_url'返回本地和在线? – Companjo
在生产中找不到文件,我甚至无法在浏览器中提取文件。但是我在本地环境中的浏览器中提取文件 – rugbert
您可能需要包含您的.htaccess。可能会有一些重写将您的文件转换为404s。 – Grumpy