Some basic stuff for working with Contao 4
The alias of start (root) page has to be index
.html
suffix from URLsAdd following code to config/config.yml
:
contao:
url_suffix: "/"
Add following code to web/.htaccess
:
# Rewrite all .html --> /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*)\.html$ %{ENV:BASE}/$1/ [L,R=301]
# add trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{THE_REQUEST} !/contao [NC]
RewriteCond %{THE_REQUEST} !/_contao [NC]
RewriteRule ^.*[^/]$ /$0/ [L,R=301]
insert after these lines:
# If the requested filename exists, simply serve it.
# We only want to let Apache serve files and not directories.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]