# Si només tenim 1 domini, no cal anomenar-lo
#ServerName www.example.com
WSGIDaemonProcess myapp python-home=/home/super/django-react/env python-path=/home/super/django-react
WSGIProcessGroup myapp
WSGIScriptAlias / /home/super/django-react/djangoreact/wsgi.py
Require all granted
Alias /static/ /home/super/django-react/static/
Require all granted
Alias /media/ /home/super/django-react/media/
Require all granted
# REACT FRONTEND
Alias /assets /home/super/django-react/react/dist/assets/
Alias /index.html /home/super/django-react/react/dist/index.html
AliasMatch ^/$ /home/super/django-react/react/dist/index.html
Require all granted
# Regla de reescriptura per a React Router
# Les rutes conegudes no entren: /admin /api /static /media i /assets
# La resta de rutes van a dist/index.html (React Router)
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/admin
RewriteCond %{REQUEST_URI} !^/api
RewriteCond %{REQUEST_URI} !^/static
RewriteCond %{REQUEST_URI} !^/media
RewriteCond %{REQUEST_URI} !^/assets
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /home/super/django-react/react/dist/index.html [L]
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined