Re: EuMVC:Dealing with favicon request
- Posted by ghaberek (admin) Apr 08, 2022
- 606 views
I'm using Apache. I will have to figure out if/how that favicon file gets served up.
Would that also apply to <img>s?
Well like I said, that depends entirely on your configuration. Here is the example .htaccess configuration from the EuMVC project:
# Add CGI handler for index.esp AddHandler cgi-script .esp DirectoryIndex index.esp Options +ExecCGI # Send all non-existent paths to index.esp RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.esp/$1 [L,NS] # Deny access to these file patterns <Files ~ ".(cfg|err|edb)$"> Deny from all </Files>
Any files that do exist will get served up when they're requested, unless denied by the <Files> block.
Any files that don't exist will be sent through index.esp. Since index.esp is running EuMVC, it will return a final 404 error if it cannot find a matching route for the requested path.
I'd recommend putting important files outside of the DocumentRoot altogether, especially any local database files you might be using. Then just access them using relative paths instead.
General "CGI best practices" are beyond the scope of EuMVC and it's worth reading through the Apache manual and doing some manual testing to ensure you understand how it all works.
-Greg