【发布时间】:2013-07-07 21:07:10
【问题描述】:
当我通过浏览器访问以下网址时,它可以正常返回 JSON 数据,
http://azcvoices.com/topcompanies/wp-content/themes/topcompanies/get.php?p=33
当 jquery 执行 ajax get 时,即使文件 get.php 如上所述确实存在于服务器上,它也会失败并使用以下代码生成 404 Not found error,
$.ajax(
{
url: "http://azcvoices.com/topcompanies/wp-content/themes/topcompanies/get.php",
type: "GET",
data: {p: postId}
})
.done(function(post) {
})
.fail(function() { alert("error"); })
.always(function() { });
您可能会看到下面的 404 错误,
目前 .htaccess 包含以下内容,
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
这会导致问题吗?
测试服务器上的相同演示, http://peplamb.com/workspace/azcentral.com/spotlight-stories/ 工作正常,但相同的代码在 http://azcvoices.com/topcompanies/spotlight-stories/
失败可能是什么问题?非常感谢任何帮助!
【问题讨论】:
-
当我在浏览器中访问该链接时,我得到一个 404...
-
你能再试一次吗?我正在测试一些东西!
标签: javascript .htaccess jquery http-status-code-404