c# - Related to url rewriting -


"i want perform 301 redirect in site. so,

  1. example.com
  2. http://example.com
  3. http://www.example.com/default.aspx

it redirect www.example.com

there lots of ways this. easiest use iis url rewrite module

alternatively, place redirect in global.asax.cs file in application_beginrequest:

void application_beginrequest(object sender, eventargs e) {      if (httpcontext.current.request.url.absoluteuri.equals("http://www.example.com/foo.aspx"))       {          string newurl = "http://www.example.com";          response.status = "301 moved permanently";          response.statuscode = 301;          response.statusdescription = "moved permanently";           response.addheader("location", newurl);          response.end();      } } 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -