Contao: After website import, the site cannot be accessed: 403 Forbidden

This is an archive post. It will not be updated.

You backed up your Contao website at one web host and then imported it again at another web host via SSH. The domain path etc. is all set correctly. Still, when you call up the domain, all you see is the message “403 Forbidden”. What’s going on?

First of all, check whether the files and folders have the correct user permissions (CHMOD). In most FTP programs you can do this by right-clicking a folder or file on the server and displaying its user permissions. For Contao, folders should have CHMOD 0755 and files CHMOD 0644.

If yours are different, you can change them very easily with SSH (terminal). Log in to the new web space via SSH and change to the base directory (usually one level above where Contao is located).

Then enter the following commands in SSH one after the other:

find ordnername/ -type d -exec chmod 755 {} + find ordnername/ -type f -exec chmod 644 {} +

Instead of ordnername (folder name), you of course use the name of the folder in which Contao is located.

This way you set the correct CHMOD for all subfolders and files of this folder at once. Then check whether the website can be accessed again.