Konfigurasi .htaccess untuk React Router

AH
Ahmad Lukman Hakim

Engineer, Jakarta

# apache

Kali ini saya ingin share snippet konfigurasi .htaccess untuk React Router supaya anda bisa mengakses static path yang anda define didalam project react.

Silahkan buat file .htaccess kemudian taruh code berikut didalamnya, dan simpan.

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

© 2026 LUKMANLAB

A special thanks for the design inspiration from mas Nur Praditya

Terms & Conditions