Last active
April 14, 2021 13:37
-
-
Save joellongie/e6f4a3b5fa98c521782619e487aca15a to your computer and use it in GitHub Desktop.
React-Router browserHistory Apache .htaccess, source: http://readystate4.com/2012/05/17/nginx-and-apache-rewrite-to-support-html5-pushstate/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.html$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.html [L] | |
</IfModule> |
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!
@Roman-Jordan glad it worked for you!
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
@vctqs1 you might want to take your question to stackoverflow...