Click here to Skip to main content
15,892,804 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I just want to know that, Is it possible to rewrite the domain name after page load

Example:

User Opens: http://www.MyWebsite.com/Home.aspx

After page load url should be -http://NewMyWebsite.com/Home.aspx

Please give me the source to study also if it is possible.

:)
Posted
Comments
Nitij 30-Mar-15 7:02am    
You would need to redirect to that new domain, there is no other way as the browsers don't allow this.

1 solution

There is no code required to do this. You can deal with this via the web.config.

XML
<system.webserver>
<rule name="Remove WWW" patternsyntax="Wildcard" stopprocessing="true">
  <match url="*" />
  <conditions>
    <add input="{CACHE_URL}" pattern="*://www.*" />
  </conditions>
  <action type="Redirect" url="{C:1}://{C:2}" redirecttype="Permanent" />
</rule>
</system.webserver>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900