我有一个有角度的应用程序,我最近添加了CLI以简化操作。除了页面刷新之外,一切正常。如果我从索引页面浏览,应用程序工作正常,但如果我尝试刷新页面或在浏览器中粘贴网址,它将返回404错误。
我已将我正在使用的所有网址重定向到服务器上的索引页面,并在索引页面中添加了基本“/”标记。
Apache配置httpd.conf
<VirtualHost *:8080>
DocumentRoot <path to dir in wwwroot>
ServerName e3edge-staging.localhost
<Directory path_to_dir_in_wwwroot>
Require all granted
</Directory>
RewriteEngine on
RewriteRule "^/team(/.*)*$" "/index.html" [PT]
RewriteRule "^/myraters(/.*)*" "/index.html" [PT]
RewriteRule "^/myreports(/.*)*" "/index.html" [PT]
RewriteRule "^/help(/.*)*" "/index.html" [PT]
RewriteRule "^/team(/.*)*" "/index.html" [PT]
RewriteRule "^/login(/.*)*" "/index.html" [PT]
RewriteRule "^/rater(/.*)*" "/index.html" [PT]
RewriteRule "^/audios(/.*)*" "/index.html" [PT]
RewriteRule "^/videos(/.*)*" "/index.html" [PT]
RewriteRule "^/assessment(/.*)*" "/index.html" [PT]
RewriteRule "^/attachments(/.*)*" "/index.html" [PT]
RewriteRule "^/home$" "/index.html" [PT]
RewriteRule "^/myprofile$" "/index.html" [PT]
RewriteRule "^/profile(/.*)*" "/index.html" [PT]
# Other directives here
# ExpiresActive On
# ExpiresDefault "access plus 1 seconds"
</VirtualHost>
的index.html
<head>
<base href="/">
<meta charset="utf-8">
<title>e3edge</title>
...
每个人似乎都在建议我已有的相同解决方案,但它似乎对我不起作用。它在localhost中的开发模式(ng serve)时有效。
任何人都可以建议这里可能有什么问题。
非常感谢