contao-4-documentation

Some basic stuff for working with Contao 4

View the Project on GitHub jodermo/contao-4-documentation

Contao 4 - Configuration

Contao Root Page

The alias of start (root) page has to be index


Remove .html suffix from URLs

Add 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]


Documentation Overwiev

Troubleshooting

© 2020 by Moritz Petzka petzka.com