.htaccess question – How to access files in wp-content/plugins/*

Hello, first post here. Just signed up yesterday and loving the site so far.

To use a non-MU plugin I installed on my new MU site (put in the /plugins/ folder), I need to access certain files like /wp-content/plugins/plugin/folder/setup_db_tables.php in both my root blog “domain.net” and MU blogs “test.domain.net” but when trying to access them, I get an Error 404 that I am pretty sure relates to the RewriteCond line in my htaccess file:

#uploaded files

RewriteRule ^(.*/)?files/$ index.php [L]

RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*

RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

So can anyone help me find the best way to access my plugin files without moving them into a different folder? Any easy change to my htaccess to make that happen? If not, will deleting that block of code do anything other than make file uploads not work?

Thanks for your help :slight_smile:

  • Aaron
    • Ex Staff

    That RewriteCond line

    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*

    from my limited understanding prevents the next rule from running:

    RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

    So in case someone links to a file like :

    “wp-content/plugins/myplugin/files/test.jpg”

    WPMU won’t send it to the blog files parser script.

    You should be able to access them, are you sure you are linking right and permissions are correct?

  • victorsmarch
    • New Recruit

    Thanks for the answers, everyone.

    I just checked a fresh download of WPMU 2.9.2, installed it and downloaded the .htaccess file, and saw that wp-content/plugins line was in there. So the problem is probably elsewhere.

    On my problem site, PHP files in the /wp-content/ folder give me a 404 but regular .html files display fine. Thus:

    – A simple ‘hello world’ HTML file in /wp-content/plugins/ or any subdirectory of /plugins/ displays fine

    – A simple PHP redirect file in /wp-content/ works fine

    – That same PHP redirect file in /wp-content/plugins/ or any subdirectory of /plugins/ gives a 404

    …so it’s probably not a permission problem either. But it probably does have something to do with htaccess considering the problem is with the /wp-content/plugins/ line, which has its own rule in htaccess.

    When I tried a fresh install using subdirectories instead of subdomains, direct linking to files in the wp-content/plugins folder worked fine. So I’m thinking maybe I didn’t set up the virtualization right.

    This being my first MU install, I googled for help on setting up the wildcard record in my DNS records using WHM or cPanel. I had been pulling from this tutorial: http://point47.com/journal/2009/12/how-to-setup-wordpress-mu-with-domain-mapping/ (Though I wasn’t setting up full domain mapping, it had basic info on the wildcard redirect that I used.)

    So following the Part 1 instructions, after I added on the domain, added * as a subdomain, and edited the DNS zone to add an A record pointing to my master IP address, I thought I was done.

    But I just realized I skipped over the Apache section of the README.txt because it seemed to be all about mod_rewrite which I knew my server supported, but I missed this part:

    “3. In the <VirtualHost> section of the config file for your host there

    will be a line defining the hostname. You need to add the following

    if you want virtual hosts to work properly:

    “ServerAlias *.domain.tld”

    Replace domain.tld with whatever your one is, and remove the quotes.”

    Does that sound like that could have caused the 404 errors for PHP files in the /wp-content/plugins/ folder? That’s the only thing I can imagine I did wrong.

    I’m kind of a noob at this server config stuff. Does anyone know where I would access that config file in cPanel or WHM or via FTP?

    Thanks for helping :slight_smile: