DEV Community

Lakshya Tyagi
Lakshya Tyagi

Posted on

1

Resolve Routing issue on Server

So i was facing Routing issue after deploying my React JS build on server. On local system my routing was working fine but after deploying over the server it wasn't routing on next pages.

Error Was

## Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at webmaster@localhost to inform them of the time this error occured, and the actions you performed just before this error.
More information about this error may be available in the server log.

---
Apache/2.4.52 (Ubuntu) Server at XX.XXX.X.XXX Port XXXX
Enter fullscreen mode Exit fullscreen mode

After trying alot i have tried to create a .htaccess file in build folder

content you can add in .htaccess file

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

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay