Skip to content

Instantly share code, notes, and snippets.

@joellongie
Last active April 14, 2021 13:37
Show Gist options
  • Star 47 You must be signed in to star a gist
  • Fork 16 You must be signed in to fork a gist
  • Save joellongie/e6f4a3b5fa98c521782619e487aca15a to your computer and use it in GitHub Desktop.
Save joellongie/e6f4a3b5fa98c521782619e487aca15a to your computer and use it in GitHub Desktop.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
Copy link

ghost commented Oct 9, 2019

Pretty much you rock for posting this. :) Just migrated servers and react-router-dom was not working. Created a .htaccess in my web root directory, then added this little jewel to the created .htaccess file and ba-da-boom, good to go. Thank You!

@joellongie
Copy link
Author

@Roman-Jordan glad it worked for you!

@keichiro13
Copy link

Thanks, something I would also add that mod_rewrite must be enabled, you can enable it running

sudo a2enmod rewrite , and don't forget to restart apache with

sudo service apache2 restart .

Have a good day

This solved it for me. Thank you verrry much ! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment