How the website was created:The website's files were copied from another machine as a compressed folder:WEBSITE.tar.gzI decompressed and moved the content to /var/html/www in the new webserver, and that gives as result that the files are for example located as follows:/var/html/www/index.html/var/html/www/css/styles.css/var/html/www/img/photo.jpegThe permissions of the files and directories resulted different than they were in the previous machine, so I researched and found this solution to quickly fix the permissions:sudo chmod -R u+rwX,go+rX,go-w /var/www/html/*I checked the permissions of the files and now they did show the way I expected:cd /var/www/htmlls -a -ldrwxr-xr-x. 2 root root size month day hour cssdrwxr-xr-x. 2 root root size month day hour img-rw-r--r--. 1 root root size month day hour index.htmlcd /var/www/html/imgls -a -l-rw-r--r--. 1 root root size month day hour photo.jpegcd /var/www/html/cssls -a -l-rw-r--r--. 1 root root size month day hour styles.cssThe problem:I still get this message when trying to access a page of the website:Forbidden You don't have permission to access /index.html on this  serverThen I did an experiment:sudo mv index.html index.html.backupsudo cp index.html.backup index.htmlAnd the page loaded normally now, but wouldn't show the image and the styles. So if I complete the process of copying I will get the image and the styles to show in the website:sudo mv css css.backupsudo cp css.backup csssudo mv img img.backupsudo cp img.backup imgIt worked, but what's the explanation? I don't want to look past the mystery, I want to know what's the normal way to solve the problem, other than copying the files.
Why website pages' access is denied by Apache unless I replace them with copies?
files;permissions;apache httpd
For GNU-coreutils ls including on Linux, dot at the end of modebits means SELinux 'context' applies -- use ls [-l] -Z (or --context) to see details -- and (recent) RedHat/CentOS by default enables SELinux to restrict access to all kinds of resources including files.Unless you want to use SELinux features to control access, the simple way to mostly ignore it is [sudo] restorecon [-R] on the files, see man restorecon; and the ways to disable SELinux are given at man setenforceRelated question What does a dot after the file permission bits mean? 