Ajax响应号召,404未找​​到号召、Ajax

2023-09-02 09:43:22 作者:黑胶唱片

我试图用字preSS和codeigniter的智能最好的CMS和最好的PHP框架之间的连接。其实我打算用codeigniter数据库managemnent和文字preSS进行显示。但我想用里面的字preSS codeigniter。所以,我有一个文件树这样的:

i tried to use wordpress and codeigniter for a intelligent join between the best CMS and the best PHP Framework. Actually i intended to use codeigniter for database managemnent and wordpress for display. But i wanted to use codeigniter inside wordpress. So, i have a file tree like that:

www
- codigniter-core folder
  - .htaccess
- wordpress-core folder
- .htaccess
- index.php

我怎样才能使这个词preSS的.htaccess也覆盖codeigniter蚂蚁不trowing jQuery的AJAX调用404错误。我现在的话preSS .htaccess文件是:

How can i make the wordpress .htaccess to cover also the codeigniter ant not trowing 404 error in jquery ajax call. My current wordpress .htaccess file it's:

<IfModule mod_rewrite.c>

RewriteEngine叙述上  的RewriteBase /  的RewriteCond%{} REQUEST_FILENAME!-f  #RewriteCond%{} REQUEST_FILENAME!-d  的RewriteCond $ 1!^ / codeigniter核心/  重写规则^(。*)$ /index.php/$1 [L]     

RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f #RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^/codeigniter-core/ RewriteRule ^(.*)$ /index.php/$1 [L]

我也试着问这字preSS论坛并codeigniter论坛,但无人接听。我认为这是一个重写条件或规则地狱,但我不知道......

I also tried to ask this to Wordpress Forums and Codeigniter Forums, but no answer. I think it's hell of a rewrite condition or rule, but i don't know ...

推荐答案

创建,我将通过jQuery的AJAX方法调用一个控制器文件时,我有这个问题。该控制器文件包括可湿性粉剂博客 - header.php文件。

I had this problem when creating a controller file that I would call via the jQuery ajax method. This controller file included wp-blog-header.php.

在包括可湿性粉剂博客 - 的header.php在一个文件中的WP框架字preSS外面做对当前文件进行检查,如果它不是在它的数据库它返回一个404左右的工作是对WP-博客 - header.php文件后添加一个200状态的头。

When you include the wp-blog-header.php in a file outside of WP framework WordPress does a check on the current file, and if it is not in its database it returns a 404. The work around is to add a 200 status header after the wp-blog-header.php.

header("HTTP/1.1 200 OK");

现在(jQuery的)AJAX的文件返回正确没有404。

Now (jQuery) ajax to the file returns properly without a 404.