0

我有我的多语言 Angular 项目,当我构建项目时,我获得了两个文件夹 en-CM 和 fr-CM,我将它们部署到在线服务器上。当我刷新页面时,它会显示 404 错误消息“找不到此页面”。我在我的 appModule 文件中使用了 HashLocationStrategy,它在站点链接上添加了一个 #。但是我希望我的链接没有#。

我看到这篇文章https://angular.io/guide/deployment#routed-apps-must-fallback-to-indexhtml我在其中配置了 .htaccess 文件,如下所示。

RewriteEngine On

# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]

# If the requested resource doesn't exist, use index.html
RewriteRule ^ /index.html

但它仍然不起作用。需要你的帮助

4

0 回答 0