Skip to content

Problem redirecting links to custom page #5106

Answered by van-vince
van-vince asked this question in Q&A
Discussion options

You must be logged in to vote

So I finally found the and on stackoverflow https://stackoverflow.com/questions/36923466/dot-and-hyphen-disallowed-react-router-url-parameters
add to webpack config

...
devServer: {
  proxy: {
    '/*.*': { // Match all URL's with period/dot
      target: 'http://localhost:8080/',  // send to webpack dev server
      rewrite: function(req){
        req.url='index.html';  // Send to react app
      }
    }
  }
}
...

If you are using Vite then this plugin will solve the issue:

Install it as a dev dependency
npm install --save-dev vite-plugin-rewrite-all

Add the plugin to your vite.conf.js file
import pluginRewriteAll from 'vite-plugin-rewrite-all'; // <= import the plugin

export default de…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@van-vince
Comment options

@aliemir
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by van-vince
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants