Forums

Accessing PDF's in /files folder (6 posts)

  1. frisco
    Member
    Posted 1 year ago #

    Running WP 3.1.1 with domain mapping and subdomains...

    I have a folder on my primary domain named /files

    Following the multi-site setup instructions, I have this line in my .htaccess

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

    However, with that line active, every effort to reach a PDF in the /files folder returns a 404 error - and an odd 404 in that my theme has a custom 404 error page and it's not that page. The 404 error returned simply says:

    404 — File not found.

    Putting the file in a folder other than /files (such as /docs) works fine. Commenting out the line allows the PDF to be opened.

    Do I need that line? I suppose it is necessary to access files in /wp-content/blogs.dir/#/files ? Is there a way to fix that other than doing a search-replace on the DB and changing all my old links from /files to /fileshurtme?

  2. Are you uploading the pdf file via the WordPress media uploader or just FTPing it?

    Have you added PDF as a trusted file type?

  3. frisco
    Member
    Posted 1 year ago #

    I'm just FTP'ing it.

    If by "trusted file type" you mean the types specified for possible upload on Network Admin->Settings, yes, PDF is there; if not, I don't know how to specify PDF as a trusted file type. How would I do that?

    I don't think it can be a "trust" issue, because just FTP'ing it to a folder other than /files works. If it weren't trusted in /files, it wouldn't have been trusted in /docs. I tried the same thing on 2 different networks and 2 different servers (admittedly on servers at the same hosting co, so if it is a server issue, they're probably set the same since I didn't change anything related to this, AFIK).

  4. I'm just FTP'ing it.

    Right then. There's your answer. The files folder is a SPECIAL virtual folder for WordPress MultiSite, you can't make it 'real' and you can't FTP files into it.

  5. frisco
    Member
    Posted 1 year ago #

    Right, that is why I am getting the 404, which I concluded.

    My question is whether I need that line in my .htaccess?

    What am I breaking by commenting it out?

    If I am breaking something important, is there an easy way to do another redirect - since I already have a lot of stuff in the real, non-virtual /files folder?

  6. My question is whether I need that line in my .htaccess?

    What am I breaking by commenting it out?

    Yes you need it. If you take it out, NONE of your images that you upload via the media uploader will work.

    Theoretically you can change it by editing your database and changing /files/ to something else, and then going in to the network admin and editing each site to change the Fileupload Url. Still, all NEW sites will need that change, and I can't promise it'll work.

    Alternatly, you could put a rule ABOVE the WordPress ones in .htaccess to say 'if you're accessing /files/(.*).pdf, go to /otherfilelocation/$1.pdf instead' (in pseudo code).

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags