Reputation: 3279
I would like to include static content in a Symfony2 project. I have auto-generated some documentation HTML files that I would like to render. They are complete HTML files, with links between them.
Thus, I would have something like:
mysite.com
: Routing managed by Symfony2, using its MVC engine.mysite.com/docs/
, mysite.com/docs/.../.../
, etc : Just return the content of those HTML static files.I guess I would need to create a bundle that deals with these static files, stored in its Resources/public
, but I don't know what is the best way to achieve this. Also, the routing should be able to recognize every route under mysite.com/docs/
.
Upvotes: 1
Views: 1441
Reputation: 4704
You can create the directory docs
in the web
directory.
If you look at the rewrite rule in the .htaccess
located in the web
directory you will see :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
It means "if the file doesn't exists, use the app.php (therefore Symfony2) file with the rewrite rule".
Thus, if you create the file (e.g docs/test.html
) in the web directory, you will be able to access it directly from mysite.com/docs/test.html
Edit :
Think about the css
and js
files for examples. When you include them, they are not handle by the router
Upvotes: 1