I currently have a live Symfony2.4 application that also links to a directory on our server (called "guides") which is under in the "web" folder. The files in this folder are generated automatically using an external program into plain html files by another department in our company.
Originally we had these files open to the public, but we'd like to make them only accessable if the user is logged into the application. We already have the site set up to handle the login process and such, I just can't figure out how to route the static files through Symfony so that I can have it use the Security process to check if the user is authorized to view the files.
I know Symfony is setup so that static files will automatically get served, so I modified the htaccess file to include this:
Anything that is a file and not in the "guide" directory should just get served.
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_URI} !/guides/
RewriteRule .? - [L]
Then I tried to make a route that can catch all the urls coming from that directory and go through a special controller where I can check for Authorized Users and redirect to a login if bad, or show the actual page if good.
support_guides:
path: /guides/{the-rest}
defaults: { _controller: MillenniumSIMeevoSupportBundle:HelpGuide:show }
The htaccess seems to work (i think) as it doesn't try to serve the page directly, but now I just get the Symfony 404 page.