27153

Domain name changes - how to redirect with ASP MVC 4

Question:

we have change our domain name from old.com to new.com and put a new ASP MVC 4 web site on old.com

Because search engine still point to old.com we would like to redirect some urls to the new one.

What is the possible ways to tap into ASP MVC pipeline to respond with redirect answer?

Thank you, Ido.

Answer1:

<blockquote>

The HTTP response status code 301 Moved Permanently is used for permanent redirection.

Google recommends using a 301 redirect to change the URL of a page as it is shown in search engine results.

</blockquote>

According to this question <a href="https://stackoverflow.com/questions/2175975/asp-net-mvc-301-redirect-from-www-domain-com-to-domain-com" rel="nofollow">here</a> you have 2 options:

<ol><li>

Installing the HTTP Redirect feature in IIS7.

</li> <li>

Do redirection at application level (using Application_BeginRequest at Global.asax).

</li> </ol>

Answer2:

If the only thing that has changed is the domain name, why not just use IIS to set up a permanent site redirect from old to new instead of using MVC?

Recommend

  • Saas with database per client - single point for entry for services. Performance overhead?
  • Why this code may crash in C++ (pointer return)? [closed]
  • Stop tramp from opening remote directories when using ido-mode
  • How to sum a row of numbers from text file— Bash Shell Scripting
  • Elmah not logging 404 (missing files / images)
  • Wordpress Create Category AJAX Response
  • How to create a fast loading wrapping ListBox?
  • Constant embedded for loop condition optimization in C++ with gcc
  • Spark dataframe to nested map
  • Problem with sockets in C#
  • Django how to modify database records by template
  • Can I put a + sign in a folder with IIS?
  • Condor job using DAG with some jobs needing to run the same host
  • ASP.NET MVC - Detect Time Spent on Page
  • Index.php as custom error page
  • Open hyperlink on click on an ggplot/plotly chart
  • Symfony2 redirect to https route fails (uses wrong port)
  • UIBarButtonItem's action is not called when in a view with a UIGestureRecognizer
  • Android distinguish between tap and double tap
  • Can't remove headers after they are sent
  • Execute scripts AJAX returns
  • Tamper-proof configuration files in .NET?
  • How to use JavaScript to determine whether a file exists in a directory?
  • How do I pass the string value parameter of the selected list item from an auto-populated dropdown l
  • Can I have the cursor start on a particular column by default in jqgrid's edit mode?
  • Javascript + PHP Encryption with pidCrypt
  • Jquery - Jquery Wysiwyg return html as a string
  • WOWZA + RTMP + HTML5 Playback?
  • Arrays break string types in Julia
  • Is there a mandatory requirement to switch app.yaml?
  • File upload with ng-file-upload throwing error
  • ExecuteAsync RestSharp to allow backgroundWorker CancellationPending c#
  • AngularJs get employee from factory
  • WPF Applying a trigger on binding failure
  • Acquiring multiple attributes from .xml file in c#
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Java static initializers and reflection
  • How does Linux kernel interrupt the application?
  • How can I remove ASP.NET Designer.cs files?
  • java string with new operator and a literal