Forum Moderators: phranque

Message Too Old, No Replies

Problems with mod rewrite / htaccess in Wordpress (I think)

Wordpress, mod_rewrite, htaccess, Cannot map GET

         

spstieng

6:53 pm on Aug 1, 2010 (gmt 0)

10+ Year Member



I've just upgraded to Wordpress 3.0 and now jQuery.post is not using correct URL.

This is mye jQuery script:

//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 reports a '404 File not found' error. This is the link:
http://mysite.com/wp-content/plugins/wp-myplugin/myfile.php


If I copy the link and paste it into my browser, the page opens just fine. No '404 File not found' error.

Looking at my Apache error log, I see the following error:

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


This is my Apache config:

NameVirtualHost localhost

<VirtualHost localhost>
ServerName localhost
DocumentRoot "I:/Development/wamp/www/"
</VirtualHost>

<VirtualHost localhost>
ServerName mysite.com
DocumentRoot I:\Development\wamp\www\mysite
</VirtualHost>


Could this have something to do with my Rewrite rule in my .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]
</IfModule>

# END WordPress

spstieng

6:54 pm on Aug 1, 2010 (gmt 0)

10+ Year Member



Can anyone tell me why the mapping is wrong?

spstieng

9:01 pm on Aug 1, 2010 (gmt 0)

10+ Year Member



Ok, I have narrowed it down to this.

I only get the problem when I turn on custom Permalink using
/%category%/%postname%
.

If I use default permalink, all works fine.

I've made sure to have the following in my Apache config file:

LoadModule rewrite_module modules/mod_rewrite.so

<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>

jdMorgan

1:09 pm on Aug 2, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't have a clue what is wrong because you've not told us what the "good" and "bad" URLs look like, nor what a "custom permalink" and "default permalink" look like.

Since mod_rewrite works based on the client-requested URLs, we need to see the actual URLs that are being requested from your server.

A tool such as the Live HTTP Headers add-on for Firefox is often very useful for this and many other problems.

If you have switched to using WP MU, then see this concurrent thread [webmasterworld.com] -- You may not be using the correct mod_rewrite code for this version of WP...

Jim

spstieng

1:19 pm on Aug 2, 2010 (gmt 0)

10+ Year Member



Hi Morgan.

The url is:
http://mysite.com/wp-content/plugins/wp-myplugin/myfile.php


And the Permalink is
/%category%/%postname%.


(as described above)

I'm not using WPMU. I just have several web projects on my computer - each using WP (single site).

I will test the plugin Live HTTP Headers.