asp.net - Global 301 redirection from domain to www.domain -
could use begin request of global.asax redirect everything,
from mydomain.domain www.mydomain.domain?
if 1 true, how can that?
protected void application_prerequesthandlerexecute(object sender, eventargs e) { string currenturl = httpcontext.current.request.path.tolower(); if(currenturl.startswith("http://mydomain")) { response.status = "301 moved permanently"; response.addheader("location", currenturl.replace("http://mydomain", "http://www.mydomain")); response.end(); } }
Comments
Post a Comment