如何在Apache服务器上安装Angular应用程序?
现在我面临着一个关于Instagram身份验证的问题。
在Angular应用程序中,如果我们想要直接访问Apache服务器上的任何angular页面,比如http://example.com/some-route
,那么我们必须在app.routing中启用'useHash: true‘。然后,它会将我作为http://example.com/#/some-route
重定向到该路由。
但在Instagram身份验证期间,IG不会在重定向URL中使用#
。现在,当我将IG重定向URL作为http://example.com/#/
传递时,它默认将身份验证参数返回为http://example.com/?code=<some-code>
,在应用程序能够捕获URL中的参数之前,Angular将其转换为:http://example.com/#/
任何帮助都是非常感谢的。
发布于 2018-12-03 14:02:42
这对我很有帮助:Deploying prod build to Apache 2
我使用以下规则创建了.htaccess文件:
<IfModule mod_rewrite.c>
Options Indexes FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
而且,现在我可以重定向到任何没有#
的组件。我在应用程序路由器中设置了useHash: false
。现在,我可以在Instagram auth之后捕获URL参数了。
https://stackoverflow.com/questions/53554771
复制相似问题