开发者

301 Redirect from sub1.mydomain.com to anotherdomain.com/sub1

开发者 https://www.devze.com 2023-01-22 06:59 出处:网络
I have already built a site with a strong page ranking in Google, but I started with too many subdomains, so I\'ve re-worked the code so that it can all be one a single domain.

I have already built a site with a strong page ranking in Google, but I started with too many subdomains, so I've re-worked the code so that it can all be one a single domain.

I have created a separate app which ought to simply act as a filter, permenantly redirecting all requests made to sub1.mydomain.com/something?id=hi to anotherdomain.com/sub1/something?id=hi. What's the best way to do this? I've tried writing a servlet but it doesn't like the url-patt开发者_如何学JAVAern /* and I have a feeling this ought to be done as a filter, but I can't get it to work like that either. What's the easiest way to do this in Java?


I just used a simple servlet doing a 301 redirect. To get the correct forwarding url, I ran a regex on the incoming url and altered it as needed.

0

精彩评论

暂无评论...
验证码 换一张
取 消