asp.net - Redirect from www to non-www with using subdomain -
i need redirect url www non-www when user enters url subdomain.
example:
www.abc.xyz.com abc.xyz.com
string url = request["http_request_url"]; // not sure exact constant name of header uri uri = new uri(url); if(uri.host.startswith("www.") && uri.host.count(c => (c == '.'))>2) { response.redirect(url.replace("www.", "")); }
thought said before, think redundant because browsers checks you...
, should avoid being "too smart own good".
Comments
Post a Comment