For the past 2 days I have been trying to get apache to serve the static files but it returns an error
I am using cPanel shared hosting. I do not have access to console only run script button.
error from console from google chrome:
style.css was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
Here are my settings:
I am redirecting passanger_wsgi to wsgi.py in Univerproject(folder where settings.py is).
Settings.py in cPanel
# Static files (CSS, JavaScript, Images)
STATIC_URL = ‘/static/’
STATIC_ROOT = ‘/home/ (my user name)/public_html/staticfiles/’
STATICFILES_DIRS=[BASE_DIR / “static”]
MEDIA_URL = ‘/media/’
MEDIA_ROOT = ‘/home/ (my user name )/public_html/media/’
.htaccess in cPanel
Alias /static/ /home/(my user name )/public_html/staticfiles/
# Serve static files directly
<Directory “/home/(my user name )/public_html/staticfiles”>
Require all granted
Alias /media/ /home/(my user name )/public_html/media/
# Serve media files directly
<Directory “/home/(my user name )/public_html/media”>
Require all granted
# Protect the project folder
<Directory “/home/(my user name )/ (my domain as folder )”>
Require all granted
Files are in public_html/staticfiles I checked.
filestructure:
logs:App 337097 output: [ pid=337097, time=2025-08-22 12:00:33,916 ]: Not Found: /static/css/style.css
