Removing the prefix (.html) from URLs

If you would like to remove the prefix from page addresses you need to add a specific line to the file 'config/config.yml'. Navigate to 'public_html/config' and edit the file 'config.yml'. If the file doesn't exist, create it. Add the following line to the file.

    url_suffix: ''

Rebuild Production Cache

Once you have added the previous code to the 'config.yml' file, on the Contao Manager under the Maintenance section click the 'Rebuild Production Cache' button. Once it is finished you are finished and the prefix will have been removed from page URLs.

Redirecting old prefix (.html) from URLs

To remove the .html extension from your urls and redirect the old, add the following code in the file "public_html/web/.htaccess"

# After RewriteEngine On

    # Removes/Redirects old .html
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)\.html$ /$1 [L,R=301]