WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Up til now, I've used /%postname%/. Now I have changed this to /%category%/%postname%/. I know WP does not recommended to use category / psotname, but it makes a lot more sense for users.

Opening pages and posts work fine. What crashes are all my jQuery calls to jQuery.php file. The data is actually returned, but when trying to output the data, I get a 404 error.

Data process:

**Fetch data**  
Ajax request -> jQuery.php -> some.class.php -> database

**Return data**  
database -> some.class.php -> json_encode($result) -> 404 error

Does anyone know how I can fix this problem? Do I have to change my .htaccess file?


This is the .htaccess file

# 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]

# END WordPress

Error message:

"NetworkError: 404 Not Found - http://mysite.com/wp-content/themes/mysite/include/jquery.php?instance=search&limit=25&term=ac"

Respons tab in Firebug shows this:

[{"id":"221","value":"Acne","url_name":"Acne"},{"id":"7176","value":"Acne Jeans","url_name":"Acne+Jeans"}]

In this case I'm expecting a autosuggest answer.

If I paste this URL directly in browser, I get the result on the screen, but i also get a 404 error message.

This is a typical jQuery request:

        url: siteURL +"/wp-content/themes/mysite/include/jquery.php",
        data: {
          instance: 'addPerson',
          name: 'Jon Doe',
          age: '26'
        dataType: 'json',
        success: (function(data) {
share|improve this question

closed as too localized by toscho Jan 2 '13 at 23:00

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Can you be a bit more specific about your issue? How are you getting a 404 error if the data is returned? – mor7ifer Mar 2 '12 at 15:27
@m0r7if3r - That's what I don't understand. I can see the data in Firebug, but the jQuery to output my feedback stops working and Firebug says I have a 404 error. – Steven Mar 2 '12 at 18:36
As in you can see data coming out? Because if data is being returned and you have a 404, something WAY weird is going on. – mor7ifer Mar 2 '12 at 18:39
@m0r7if3r - Yes, something weird is going on. If I paste this URL directly in the browser, the data is returned and outputted, but it also gives a 404 message... – Steven Mar 2 '12 at 18:42
Are you posting the request through admin-ajax.php? – mor7ifer Mar 2 '12 at 18:48

Is your rewrite rule in your .htaccess well configured? Can you post it here?

Should be configured like this:

# 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]
# END WordPress

Source: Codex page on pretty permalinks

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.