asp.net mvc - How to redirect a page that has moved? -
i have page in mvc asp.net project has gone away. we've renamed url entirely different.
the problem other sites still link particular url.
we blank out html url in question , meta refresh or javascript script call take them new page, doesn't fit our model.
i add route, , let asp.net take care of it, hardcoding routes urls forwarded seems bad practice. edit asp.net page , use response.redirect, there's no real page in existence since light cms...
how should redirect user url landing page different landing page using best practice? don't need user see "this page has moved" or part of requirement.
it looks need return http 301 status code, moved permanently. this answer appears outline general approaches in asp.net mvc.
for example:
public actionresult page() { response.status = "301 moved permanently"; response.addheader("location","http://example.com"); }
this result in returning mentioned http 301, followed search engines , user's browsers transparently.
Comments
Post a Comment