Add .htaccess for URL rewriting and client-side routing - #87
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
public/.htaccesswith Apache rewrite rules (automatically copied intodist/at build time, same asrobots.txt/sitemap.xml)Why
https://cadviewer.xyz/viewerwere returning a server-level 404 — confirmed via a fresh incognito test after the previous mergevite-react-ssgnow buildsviewer.htmlas a real static file at the build root, but Apache had no rule mapping the clean URL/viewerto that file/viewerbefore, since navigation always happened by clicking from the landing page.htmlfile (e.g./viewer→viewer.html), and fall back toindex.htmlfor anything else so unmatched paths still show the app's own 404 page instead of a generic host error pageValidation
dist/.htaccessexists with the exact intended content)https://cadviewer.xyz/viewerloads correctly as a fresh direct visit (not just by clicking through from the homepage)https://cadviewer.xyz/andhttps://cadviewer.xyz/sitemap.xmletc. still work normally (unaffected)Notes
.htaccess— if this doesn't resolve it after deploying, the server may need a different config, worth checking with whoever manages the Hostinger accountnpm run previewwon't reflect this fix, since.htaccessonly applies on the real Apache server, not Vite's local preview — live verification is the real test