Reputation: 1103
I have a symfony backend installed on my server and in the symfony/web folder I have created a new folder "app" and there is an index.html. If I call https://example.com/app/ I'm getting 404 and with https://example.com/app/index.html it is working. I have tried to change the DirectoryIndex in the symfony .htaccess from this:
DirectoryIndex app.php
To this:
DirectoryIndex app.php index.html
But it is still not working. How can I do it that if I call example.com/app/ the index.html will be opened (just for that folder to not destroy the symfony settings)?
Upvotes: 0
Views: 335
Reputation: 785276
You can use this line at top of your app/.htaccess
:
DirectoryIndex index.html
RewriteEngine On
RewriteCond %{THE_REQUEST} /index\.html [NC]
RewriteCond %{REQUEST_URI} ^(.*/)index\.html$ [NC]
RewriteRule ^ %1 [L,R=301,NE]
# remaining rules go below this
Upvotes: 1
Reputation: 1693
Easiest way to do it:
# end of routing.yml
redirect_to_index:
path: /app/?
defaults:
_controller: FrameworkBundle:Redirect:urlRedirect
path: /app/index.html
permanent: true
But it will be /app/index.html
, not just /app/
.
Upvotes: 0