If you are using connect-history-api-fallback on your server (like lite-server does), the URLs with a dot are not rewritten by default.
connect-history-api-fallback code
if (parsedUrl.pathname.indexOf('.') !== -1) {
logger(
'Not rewriting',
req.method,
req.url,
'because the path includes a dot (.) character.'
);
return next();
}
Starting with connect-history-api-fallback
version 1.2.0 the URLs with dots are allowed and you can solve this problem by using a a rewrite roule
Example
If your URL with dot is /search-result
and you angular app lives in the index.html
page you can add a rewrite rule to the connect-history-api-fallback like this
rewrites: [
{
from: /^/search-result/,
to: 'index.html'
}
}
]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…