如何为angularjs网站执行301重定向 [英] How to do 301 redirect for a angularjs website

查看:64
本文介绍了如何为angularjs网站执行301重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有angularJs网站,当前我们有一个要求,我们需要从该站点进行301重定向,例如,如果用户访问"A"页面mysite.com/A,则需要重定向到mysite.A.com.

We have angularJs website and currently we have a requirement we need to do a 301 redirect from the site for example if user access "A"page mysite.com/A, we need to redirect to mysite.A.com.

我们想在路由,.htacess或nginx配置中进行操作,想知道什么是处理这种情况的最佳方法. 如果您提供最佳选择的代码段,可以.

Wanted to know what is the best way to handle this situation, should we do in route or .htacess or nginx config. Can if you provide a snippet for best option.

推荐答案

将此添加到您的 nginx 服务器配置:

Add this to your nginx server config:

location = /A { return  301 http://mysite.A.com/;   }

这篇关于如何为angularjs网站执行301重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆