Skip to content

Commit

Permalink
refactor: switch from hash to browser routing
Browse files Browse the repository at this point in the history
- Remove hash-based routing in favor of cleaner URLs
- Add 404.html redirect for GitHub Pages client-side routing support
- https://stackoverflow.com/questions/78738394/encountered-an-issue-deploying-my-website-vitereact-to-github-pages
  • Loading branch information
ligsnf committed Dec 23, 2024
1 parent bc65b20 commit cd20d03
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions public/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Redirecting...</title>
<script>
window.location.href = '/monash-grades-calculator/';
</script>
</head>
<body>
Redirecting...
</body>
</html>
6 changes: 5 additions & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { StrictMode } from 'react'
import ReactDOM from 'react-dom/client'
import './index.css'
import { RouterProvider, createRouter } from '@tanstack/react-router'
import { RouterProvider, createRouter, createBrowserHistory } from '@tanstack/react-router'
import { ThemeProvider } from "@/components/theme/theme-provider"

// Import the generated route tree
import { routeTree } from './routeTree.gen'

// Create browser history
const browserHistory = createBrowserHistory()

// Create a new router instance
const router = createRouter({
routeTree,
basepath: "/monash-grades-calculator/",
history: browserHistory,
})

// Register the router instance for type safety
Expand Down

0 comments on commit cd20d03

Please sign in to comment.