react refresh 404 - mowen0303/note GitHub Wiki

1. create .htaccess file at website root

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule . /index.html [L]
</IfModule>

2. enable rewrite module on apach server

rfe: https://tecadmin.net/enable-disable-modules-in-apache2-on-ubuntu-linuxmint/

We use a2enmod command to enable modules in Apache2 web server. For example, if we need to enable the Apache rewrite module use the following command.

sudo a2enmod rewrite

Then reload the Apache configuration.

sudo systemctl relaod apache2 

Check Modules Status

sudo a2query -m rewrite 

Output
rewrite (enabled by site administrator)

List Apache2 Modules

sudo a2query -m 

3. update apache2.conf file

open file on server /etc/apache2/apache2.conf and change AllowOverride None to AllowOverride All

<Directory /var/www/>
	Options Indexes FollowSymLinks
	AllowOverride All
	Require all granted
</Directory>
⚠️ **GitHub.com Fallback** ⚠️