Jump to content

File downloads throwing a 404?


FuturShoc
 Share

Recommended Posts

Here's my dev site.

http://ahaa.inthooz.me/state-forms/

I've used a standard body field for this page's template and added a list to the page. Each list item has a link to a file download. Those files are just uploaded to a subfolder of the site root. The links to those files (.doc and .docx) ARE valid, but clicking those links throws a 404 from PW.

Can anyone tell me why or how to fix this? I don't remember this ever being an issue before.

Link to comment
Share on other sites

The first thing I notice is the spaces and mixed case in the filenames. This is a bad idea for lots of reasons which is why if you uploaded the docs via a Files field in PW it would have converted them for you.

I think what is causing the 404 is PW's htaccess rewrites. It sees:

http://ahaa.inthooz.me/assets/form-downloads/

and goes looking for a page with that path. You could potentially move form-downloads into:

http://ahaa.inthooz.me/site/assets/form-downloads/

and things should work just fine.

But, why not upload them to PW and have files that are part of the system?

EDIT: having them all in a files field in PW means you could use this code to provide download links to all and it would automatically work for all new files as they are added:

echo "<ul>";
foreach($page->files as $file){
     echo "For the {$file->description} form, <a href='{$file->url}'>click here!</a>";
}
echo "</ul>";

Although personally I hate "click here" links, but I went with how you had things structured already :)

Edited by adrian
  • Like 3
Link to comment
Share on other sites

Thanks, adrian. Unfortunately, moving them to /sites/ didn't change my issue.

Yes, I agree that moving the files into the CMS itself would be best, but I was looking for a quick fix. Looks like I'll have to go that route!

Link to comment
Share on other sites

If it's not working from inside site/assets, then I think there must be something else at play. I actually just tested locally and I can even download:

http://pwtest.dev/assets/form-downloads/11 AHAA SPRING DISTRICT MEETING FORM.doc

just fine, and looking at PW's htaccess there is a rule for ignoring folders when rewriting so it should work and it does - my mistake above.

EDIT: I see that: http://ahaa.inthooz.me/assets/img/ahaa-header-logo.png

works fine on your site, so can you narrow it down to the form-downloads folder or the mixed case/space ridden filenames?

Have you switched servers? Do the cases of the filenames in the links actually match the filenames? ie Windows vs Linux issue?

ANOTHER EDIT: It is weird to me that the page you are getting when trying to download is actually the homepage with a 404 header and not the actual 404 page.

AND ANOTHER:

Notice that:

http://ahaa.inthooz.me/site/assets/form-downloads/dd.doc'>http://ahaa.inthooz.me/site/assets/form-downloads/dd.doc

gives you a proper 404 page, but:

http://ahaa.inthooz.me/site/assets/form-downloads/d d.doc

takes you to the homepage with a 404 header. 

Turns out I get the same thing locally!

Edited by adrian
  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...