I am happy because I solved a problem with one of my WP plugins, which I could not get working (now-reading). The problem was not especially related to this plugin, but it took me hours to understand the cause.

Problem:

When trying to directly load a .php file in the plugin directory, it would redirect me to index.php and WP would show the 404 error page. No problem for .php files included by others.

Concrete example:

When trying to save the options of “Now Reading”, the form would be sent to the following file: /wp-content/plugins/now-reading/admin/options.php but instead of loading this file, it would load index.php and display a 404 error.

Same thing when trying to add a book, for the following file: /wp-content/plugins/now-reading/admin/add.php

Explanation:

So what was happening?

I tried to look at my rewrite rules, suspecting a problem with WP rewrite rules, in vain.

It appears that the solution is much simpler: my web host apache server settings are such that you cannot directly load a .php script which has write permission for group members. Same restriction for scripts located in a directory that has write permission for group members.

By comparing the now-reading directory (and subdirectories) with my other plugins’, I found that the permission was 775 instead of 755. And the file permissions were 664 instead of 644.

Solution:

I changed my directory permissions to 755 and file permissions to 644, and… it worked!

Que d’émotions ;)