将html页面重定向到mvc中的控制器操作 [英] Redirecting html pages to controller action in mvc

查看:115
本文介绍了将html页面重定向到mvc中的控制器操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在html中创建了一个网站。它有很多html页面。



现在我们已将此网站移至mvc应用程序。



但问题是,当用户在谷歌搜索我们公司的东西时会给出结果......



www.abc.com /home.html



但是当我们移动这个mvc时,home.html页面已不复存在。



当用户点击www.abc.com/home.html页面时未找到错误。



有人知道我们如何重定向到mvc中的www.abc.com/home/index????



我尝试了什么:



我们试图用rounting做一些事情,但它对我不起作用。

解决方案

使用url重写模块映射你的旧网址到新网址



网址重写:官方Microsoft IIS站点 [ ^ ]


这就是你不应该删除引用的原因该应用程序必须是静态页面。此页面home.html是您网站上的静态网页,也会在Google上编制索引。删除该页面是个坏主意。



我的建议是不要再往前走,而是让页面回来。但是,不是完整的网页,而是编写JavaScript重定向代码并将用户重定向到下一页。你可能还需要与机器人聊天,让搜索引擎定位新的主页。



 <   html  >  
< head >
< title > 我的网页< / title >
< script >
// 移至新页面。
window . location = http://www.abc.com/home/index;
< / script >
< / head >
< / html >





这样做可以胜任。无论如何,我的另一个建议是在你的开发团队要求新的建筑设计之前与你的SEO团队交谈。 : - )


We had one website created in html.It has has many html pages .

Now we have move this website to mvc application.

but issue is when user search something for our company in google it give result like...

www.abc.com/home.html

but as we have move this mvc , the home.html page is no more.

therefor when user clicks on "www.abc.com/home.html" page not found error come.

Can someone have any idea how can we redirect to "www.abc.com/home/index" in mvc????

What I have tried:

We tried to do something using rounting but it not works for me.

解决方案

Use the url rewriting module to map your old urls to new ones

URL Rewrite : The Official Microsoft IIS Site[^]


That is exactly why you should not delete the references that application had to static pages. This page, "home.html" was a static web page in your website which is indexed on Google too. Deleting that page was a bad idea.

My recommendation is not to move further, instead have the page back. But instead of a full web page, write JavaScript redirect code and redirect the users to the next page. You may also have to chat with the bots to let search engines target the new home page.

<html>
   <head>
      <title>My Web Page</title>
      <script>
         // Move to the new page.
         window.location = "http://www.abc.com/home/index";
      </script>
   </head>
</html>



This would do the job. Anyways, my other recommendation is to talk to your SEO team before asking for a new architectural design from your development team. :-)


这篇关于将html页面重定向到mvc中的控制器操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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