All files from download_file URL giving 404!

Permalink
Hi all

I'm not far from launching a site and have been putting in the content, only to discover that all URLs placed by the content block (TinyMCE) go to a 404 page. Here's an example of a link:

http://development.url.com/sniffer/index.php/download_file/view/59/...

and it's actual location (which exists, and is accessible if pasted directly into the browser's location bar) is

http://development.url.com/sniffer/files/7013/4139/1573/A20Flourish...

I have pretty URLs turned on, but they work perfectly well in every other instance.

I've looked in PHP's logs and can find nothing that's obviously related. Same for concrete5's internal log.

Can anyone help? This is a pretty colossal problem :(

melat0nin
 
melat0nin replied on at Permalink Reply
melat0nin
I have another c5 installation in another folder at the same level as this one, also running 5.5.2.1, and it doesn't have the problem o.O. I've diffed the two complete concrete/ folders and they're identical, with the exception of a change or two I made to the date_time helper for localisation.

I'm stumped :(
frankdesign replied on at Permalink Reply
This happens only when you use TinyMCE? Not when you add a file from the file manager?
melat0nin replied on at Permalink Reply
melat0nin
Same thing I guess -- it happens when I click the Add File link when editing a Content block.

Also when I insert an image this way it doesn't appear in the TinyMCE editor, but when I save the block it does display on the page.
melat0nin replied on at Permalink Reply
melat0nin
Actually the File block doesn't work either -- same problem.
frankdesign replied on at Permalink Reply
Did you copy the files across for the entire site or actually install it? I have a _feeling_ that when you install it, there are some jobs ran that change some of the download mechanisms. If you just copied the site, try installing it and then moving your custom theme etc. into it.
melat0nin replied on at Permalink Reply
melat0nin
Nope the site was installed where it is. I can't really re-install it now because there's a ton of stuff in the database :/
frankdesign replied on at Permalink Reply
Ok, you wont have to reinstall it. Just as long as it was installed.
frankdesign replied on at Permalink Reply
Also, maybe check that the .htaccess file is correct. I am not sure what it is meant to be if you're running two sites from two different directories. I am guessing it is right though, otherwise your permalinks wouldn't work.
melat0nin replied on at Permalink Reply
melat0nin
Thanks for your replies.

What I mean is I have a two installations at

http://dev.url.com/site1
http://dev.url.com/site2

Both are 5.5.2.1. Site1 doesn't work but Site2 does.
frankdesign replied on at Permalink Reply
I will try and replicate this.
frankdesign replied on at Permalink Reply
I have just tried 5.5.2.1 and put it in a directory like:

myserver.com/site1


And turned on pretty links etc. It seems to work fine.

Here are a few ideas, anyway... your .htaccess file should look like this:

# -- concrete5 urls start --
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /sniffer/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>
# -- concrete5 urls end --


If you are over-riding anything to do with the downloading of files, even if it is the download_file.php in single_pages, I would disable them. I have found that some of the core files do not play well even if you create your own in the custom directory structure.

Try re-uploading a file to check that it's not something to do with the database reference to ones that you have already uploaded.
melat0nin replied on at Permalink Reply
melat0nin
htaccess looks fine.

As far as I can tell I'm not overriding anything important -- I have some custom controllers for single pages but nothing to do with downloading files.

I've uploaded several files, both replacing existing ones and new ones totally unrelated and it's always the same :(
frankdesign replied on at Permalink Reply
Try disabling your custom controllers and single_pages - I know this sounds silly even though they seem unrelated but I have, on a few occassions, learned that sh*t happens :D

Also, I notice that your download link's format is:

index.php/download_file/view/number/number

Mine only has one /number. Don't know if this is anything important.
melat0nin replied on at Permalink Reply
melat0nin
Tried that, no joy :(

I've absolutely no idea what's going on here.

I wonder if there's a way to disable the download_file controller and to insert static file URLs instead D:
frankdesign replied on at Permalink Reply
Underneath line 16 in /concrete/controllers/download_file.php try adding this:

var_dump($file);


See if you get a file object returned.
melat0nin replied on at Permalink Reply
melat0nin
Hmm it doesn't seem to be properly rendering the view I don't think -- it's as though it can't find the controller. I get the generic Page Not Found screen and can't see any output from var_dump(). If I put an addHeaderItem() into view() in download_file.php nothing goes into the header...

Can I PM you a link to the file so you can see what happens?
frankdesign replied on at Permalink Reply
Sorry, should of said:

var_dump($file);
die();


Weird. Yes you can pm me
MattWaters replied on at Permalink Reply
MattWaters
Do you have url rewriting enabled in your "root" level site, like so?

http://development.url.com/.htaccess...

That could affect sites in subfolders in unintended ways.
melat0nin replied on at Permalink Reply
melat0nin
I got the answer from Mnkras over here:http://www.concrete5.org/community/forums/customizing_c5/all-files-...

It was as simple as the Download File page having been removed from the Sitemap -- all it needed was to add it again through Single Pages and everything is working again!