title: react-router throwing 404 upon page refresh with React app hosted on GoDaddy
body: <p>I deployed a React website using GoDaddy (<a href="http://normaned.com" rel="noreferrer">http://normaned.com</a>), and I’m having trouble with my <code>react-router</code> routing not working upon refresh. Clicking on links works as expected, but if a page is refreshed a 404 page is displayed. I’m using <code>BrowserRouter</code> from <code>react-router</code>.</p>
  
  <p>The GoDaddy hosting plan is "Economy Windows Hosting with Plesk". Unfortunately, I’m not the one who set up the hosting service, and I’m unsure if I can change from Plesk to cPanel without extra monetary cost... or if that would even be a way to get closer to solving my problem (i.e., Windows vs Linux hosting).</p>
  
  <p><strong>EDIT 10/19: I now realize that the server is a Windows IIS server, and I need a <code>web.config</code> file (not a <code>.htaccess</code> file). Though, I'm still unsure of what code needs to go in the <code>web.config</code> file.</strong></p>
  
  <p>Here is my GitHub repo for the website: <a href="https://github.com/jenna-m/norman-ed" rel="noreferrer">https://github.com/jenna-m/norman-ed</a></p>
  
  <hr>
  
  <p>I have tried suggested methods I’ve found on StackOverflow, the GoDaddy help forum, and elsewhere, but it’s still not working. <strong>Here are some things that I’ve tried:</strong></p>
  
  <p><a href="https://stackoverflow.com/a/40591955/11995771">https://stackoverflow.com/a/40591955/11995771</a></p>
  
  <p><a href="https://gist.github.com/alexsasharegan/173878f9d67055bfef63449fa7136042" rel="noreferrer">https://gist.github.com/alexsasharegan/173878f9d67055bfef63449fa7136042</a></p>
  
  <p>I’ve tried adding the following to an <code>.htaccess</code> file in the <code>public_html</code> root directory:</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule . /index.html [L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>I created the <code>.htaccess</code> file directly in Plesk, making sure that no extra characters were added (as suggested in this article (<a href="https://www.godaddy.com/help/what-is-htaccess-2504" rel="noreferrer">https://www.godaddy.com/help/what-is-htaccess-2504</a>)</p>
  
  <p>After trying to solve the problem for a bit, I realized that this might have to do with the fact that I’m using Plesk vs cPanel. So, I found these potential work arounds:</p>
  
  <p><a href="https://support.plesk.com/hc/en-us/articles/115001697373-Website-with-configured-htaccess-is-not-working-404-Not-Found" rel="noreferrer">https://support.plesk.com/hc/en-us/articles/115001697373-Website-with-configured-htaccess-is-not-working-404-Not-Found</a></p>
  
  <p><a href="https://support.plesk.com/hc/en-us/articles/115003015833-Redirection-rules-in-htaccess-file-do-not-work-in-Plesk" rel="noreferrer">https://support.plesk.com/hc/en-us/articles/115003015833-Redirection-rules-in-htaccess-file-do-not-work-in-Plesk</a></p>
  
  <p>I thought that either of these solutions would work, but they didn't.</p>
  
  <p>I found this post from Plesk support (<a href="https://support.plesk.com/hc/en-us/articles/115000063989-Does-Plesk-support-Apache-web-server-for-Windows-" rel="noreferrer">https://support.plesk.com/hc/en-us/articles/115000063989-Does-Plesk-support-Apache-web-server-for-Windows-</a>), which lead me to this Microsoft article (<a href="https://blogs.msdn.microsoft.com/azureossds/2015/04/23/converting-apache-htaccess-rules-to-iis-web-config-using-iis-manager-for-azure-websites/" rel="noreferrer">https://blogs.msdn.microsoft.com/azureossds/2015/04/23/converting-apache-htaccess-rules-to-iis-web-config-using-iis-manager-for-azure-websites/</a>).</p>