× Here you can get community support related to ReDJ.

Problem with Internal Redirect (200) for files

  • joomlamus
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 8 months ago #2861 by joomlamus
Hi Luigi,

I created a redirection rule to shorten the path to download files. Eg. in typing www.siteurl.de/dl/nicefile.pdf visitors should get the file www.siteurl.de/images/download/nicefile.pdf. The rule is

FROM: ^/dl/
TO: http://{siteurl}/images/download/{pathltrim /dl/}{queryfull}

With 307 everything is ok, but with 200 I get a 404 error message. The 404 message is not from the server, but from joomla. It says either "article not found" or "category not found", depending on the file name I try, but gives the correct URL as error code (eg. "Did not found category (www.siteurl.de/images/download/nicefile.pdf)"). For me it looks like joomla "captures" the 200 request and tries to handle it as article- or category-alias instead of letting the server deliver the requested file. Is there a way to tell joomla not to do this, or do I have to change the redirection rule? Or is it just not possible to do 200 file redirects with ReDJ?

Regards,
Paula

Please Log in or Create an account to join the conversation.

More
9 years 8 months ago #2863 by admin
Hi Paula,
what you want to do is impossible to accomplish with a 200 (internal redirect) and this is the expected behavior. The reason is not so hard to understand. You are pointing to a static asset, a file that should be managed by the web server itself (e.g. apache). If you are able to manage with an internal rule this means that the file doesn't exist so the web server has passed the request to Joomla. At this point is Joomla that must serve the request, but Joomla routing is not able to manage static assets. When the routing process fails to solve the extension, it defaults to content extension, but finally the content doesn't exist. You could manage with 301 or 307 (and for me is not a problem).

Kind regards,
Luigi

Please Log in or Create an account to join the conversation.

  • joomlamus
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 8 months ago #2867 by joomlamus
Replied by joomlamus on topic Problem with Internal Redirect (200) for files
Hi Luigi,

thank you very much for your explanation. The reason not to choose 301 or 307 is that the visitors shall not see the directory the file is really in but only the requested URL. Do I get it right, to reach this I have to redirect in .htaccess with mod_redirect?

Paula

Please Log in or Create an account to join the conversation.

More
9 years 8 months ago #2868 by admin
Hi Paula,
using mod_redirect works because the redirect is made by apache itself. Is a fast solution if you have a few files only. But if you need this for a lot of files, you could use an extension to manage downloads blocking direct access.

Luigi

Please Log in or Create an account to join the conversation.

Time to create page: 0.101 seconds