Do you have a .htaccess file in ./public_html/? If so, what's inside it? The way .htaccess works is by giving the directory closest to the actual root top priority.
As an example:
/home/username/public_html/.htaccess
is given a higher priority (i.e. more control) than
/home/username/public_html/sub_directory/.htaccess
If you're primary .htaccess
file is setting rules one way and the sub-directory is setting them another, it's possible you'll run in to issues (i.e. an error).
If you're set in your actual web root, the following lines could be causing some issues as cPanel allows server administrators to set these options by default from within WHM. If these are already set (specifically -Indexes), you'll likely see an error.
Options All -Indexes
Options +FollowSymLinks -MultiViews
Note: The -Indexes
directive is normally set by default before clients are even placed on a server (or it should be, unless there's a specific reason not to), FYI. This is more of a security recommendation to prevent directory browsing as not every client is going to know that unless there's an index.[ext]
file in every directory, their directories are wide-open for browsing by whoever wants to take a look.
If removing those resolves the error, then you've found the problem :). If removing these lines does not work, trial & error is where we need to start.
Back to the top, look in directories that reside above the directory you're having issues with. Check the .htaccess files and make sure you have "display or show hidden files" checked or set to "yes" in the S/FTP program that you're using as they're not always visible by default.
From here, the best course of action would be to backup each .htaccess file and re-add them one-by-one until you run in to another error. This way you can mark down which file upload brought on the error and we can take a look at that one.
Update #01
Since the culprit for the error most likely was indeed the -Indexes
, you can add the following back to the .htaccess
file:
Options +FollowSymLinks -MultiViews
If that does not resolve the 404, try this:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
# Adds Trailing Slash to the URI as long as it's not for a
# file.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
RewriteRule ^(.*)$ http://subdomain.example.com/$1/ [R=301,L]
# Checks to make sure the request is a directory.
# Checks to see if the request matches a file with a .php ext.
# If all is well, push the request through to the matching file.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^\.]+)/$ http://subdomain.example.com/$1.php