Files ending in .php in the wp-content/plugins/ directory are treated as Not Found

For some strange reason every file I attempt to access in my WordPress installation inside the wp-content/plugins/ directory and underneath return a WordPress based 404 error. The files appear in directory listings…

like this: http://technologysolved.ca/wp-content/plugins/store-locator/js/

Read More

when other files types (.js and .html) are clicked they work correctly. But when a file like: the store-locator-js.php is clicked WordPress returns a 404 style error.

This happens with all .php files in the plugins directory and below.

I believe this may be some kind of .htaccess more mod_rewrite error but I am not sure.

My .htaccess file is the following…

RewriteEngine On
RewriteBase /

RewriteRule ^index.php$ - [L]

RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]

Any help would be appreciated. Thanks!

Related posts

Leave a Reply

2 comments

  1. First of all, you should never be accessing PHP files in a plug-in directory directly in the browser. The very fact that you can even see a directory view in the browser is a security issue with your site!

    But let’s say, for the sake of argument, that things are working fine and you still need direct browser access to this file. Even then, accessing a PHP file directly like this would not start WordPress, meaning you will have no access to your blog, your theme, your posts, or the WordPress API.

    Remember, PHP is meant to be executed on the server – it is server-side code. JS and HTML are considered text documents until they’re interpreted by the browser – they are client-side code. You should not be able to view the content of a PHP file by clicking its name in a directory view. This will attempt to execute the code contained in the file on the server. In your case, the plug-in file is also referencing WordPress (probably loading a bootstrap file) and throwing an error.

    So no, this is not an error in .htaccess or mod_rewrite.