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)?
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
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/
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.