I have a project in Azure virtual machine with "myproject.cloudapp.net" techical address and "myproject.com" domain. Search engines have indexed technical address(myproject.cloudapp.net) and my project in search results with technical address now.
How to hide azure vm address(*.cloudapp.net) from search engines?
I presume you have a web-application. You'll have to create a redirecting rule which checks what domain been requested and if it matches *.cloudapp.net
, then do a permanent redirect to mydomain.com
.
In web.config
something like this answer:
<rewrite>
<rules>
<rule name="Redirect to www" stopProcessing="true">
<match url="(.*)" />
<conditions trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="^.*.cloudapp.net$" />
</conditions>
<action type="Redirect"
url="{MapProtocol:{HTTPS}}://www.domain.com/{R:1}" />
</rule>
</rules>
<rewriteMaps>
<rewriteMap name="MapProtocol">
<add key="on" value="https" />
<add key="off" value="http" />
</rewriteMap>
</rewriteMaps>
</rewrite>
Disclaimer: I have not tested this redirect in web.config
. My applications are running Asp.Net MVC and I do redirects by adding a global filter which does a bit more checks.