Skip to content

GitHub Pages website connected to another domain, but I can still access via .github.io? #22316

Answered by jrinkman
jrinkman asked this question in General
Discussion options

You must be logged in to vote

I’ve fixed the problem, however, not how I would have liked to (without tampering with the actual website). Regardless, I’ve added a URL check which ensures the user is using the correct address within the index.js file of my React project. Even if you’re not using React, you can still place this code anywhere as long as it runs when the page initializes. I’ve included a commented version of the code below, but again, you’ll need to adapt this for your URLs and if you’re not using React.

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './components/App';
import { BrowserRouter } from 'react-router-dom'
import registerServiceWorker from '.…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants