Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 在nginx中重新路由到登录页面_Angular - Fatal编程技术网

Angular 在nginx中重新路由到登录页面

Angular 在nginx中重新路由到登录页面,angular,Angular,我已经使用Nginx部署了我的应用程序我的应用程序URL是用户连接。登录后,在中,URL更改为用户连接。在/home中。如果我将URL地址更改为user connect.in/homeasdasd(一个随机名称),它应该被重定向到登录页面 但实际发生的是,它显示了404 Not found错误nginx/1.19.2。我在localhost中尝试了同样的方法,但它被重定向到localhost。我不知道在使用nginx部署应用程序后如何实现同样的效果。您在nginx.conf中设置了URL重写规则

我已经使用Nginx部署了我的应用程序我的应用程序URL是用户连接。登录后,在中,URL更改为用户连接。在/home中。如果我将URL地址更改为user connect.in/homeasdasd(一个随机名称),它应该被重定向到登录页面


但实际发生的是,它显示了404 Not found错误nginx/1.19.2。我在localhost中尝试了同样的方法,但它被重定向到localhost。我不知道在使用nginx部署应用程序后如何实现同样的效果。

您在nginx.conf中设置了URL重写规则吗

location / {
   try_files $uri$args $uri$args/ /index.html;
}

当服务器上不存在URL时,这将返回index.html而不是404,因此角度路由可以接管客户端。

我想我没有这样做。