Welcome Guest, Not a member yet? Register   Sign In
file_get_contents causes a 404 error
#8

After a bit more digging, I now understand.

In my Apache VirtualHost configuration, I had (among other things)

Code:
<VirtualHost *:80>
  <Directory "/">
    DirectoryIndex index.php
    ErrorDocument 404 /
  </Directory>
</VirtualHost>
which means that any 404 document was getting handled by /index.php which of course then routed it properly and displayed the page correctly.
Removing the ErrorDocument directive then caused a URL such as
http://www.domain.com/storage/item/57d952d0a09d0
to break, whereas in the form
http://www.domain.com/index.php/storage/item/57d952d0a09d0
it works properly.

Having now also discovered the FallbackResource directive, my VirtualHost will look more like

Code:
<VirtualHost *:80>
  <Directory "/">
    DirectoryIndex index.php
  </Directory>
    
  FallbackResource /index.php
</VirtualHost>

since the fallback means there should never be a 404...

So now everything is working as I expected it to with my first cut code. Happy days.

Hopefully this information will ease someone else's pain in the future...

Best wishes,
Gordon
Reply


Messages In This Thread
RE: file_get_contents causes a 404 error - by gordski68 - 09-16-2016, 04:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB