現在、いくつかの jQuery スクリプトで jQuery.post を使用していますが、すべて正常に動作します。しかし、WordPress 3.0 にアップグレードした後、動作しなくなりました。
私は次のjQueryコードを持っているプラグインに取り組んでいます:
//Delete event and remove from UI
jQuery("#eventList .cancelEvent").live('click', function() {
jQuery.post("/wp-content/plugins/wp-eventcal/myfile.php", { instance: 'cancelEvent' },
function(data)
{
alert('test'); // Never fires because 404 File Not Found
});
});
Firebug は「404 ファイルが見つかりません」というエラーを報告します。これはリンクです: http://mysite.com/wp-content/plugins/wp-myplugin/myfile.php
リンクをコピーしてブラウザに貼り付けると、ページが問題なく開きます。「404 ファイルが見つかりません」エラーはありません。
Apache エラー ログを見ると、次のエラーが表示されます。
Cannot map GET
/wp-content/plugins/I:/Development/wamp/www/norwegianfashion/wp-content/themes/norwegianfashion/images/icon.png HTTP/1.1 to file,
referer: http://norwegianfashion.com/wp-admin/admin.php?page=wp-eventcal/eventcal-manager.php
これは私の Apache 設定です:
LoadModule rewrite_module modules/mod_rewrite.so
NameVirtualHost localhost
<VirtualHost localhost>
ServerName localhost
DocumentRoot "I:/Development/wamp/www/"
</VirtualHost>
<VirtualHost localhost>
ServerName mysite.com
DocumentRoot I:\Development\wamp\www\mysite
</VirtualHost>
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
そして、これは私の .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
アップデート
わかりました、これに絞り込みました。
/%category%/%postname% を使用してカスタム パーマリンクをオンにした場合にのみ問題が発生します。
デフォルトのパーマリンクを使用すると、すべて正常に動作します。
繰り返しますが、それは私の .htaccess ファイルでしょうか?