0
votes

I have a Wordpress-based web site hosted in Azure websites with a custom domain (www.mydomain.com) that is working great.

Now I want to let another domain (www.anotherdomain.com) respond to the same Azure website. But www.anotherdomain.com is an old website where its pages are no longer available either in new or old places.

This means I need to redirect any URL from www.anotherdomain.com to the root (home page) of www.mydomain.com without any http error messages.

Example: www.anotherdomain.com/products/blablabla.aspx to www.mydomain.com

I suppose I have to add some rewrite rules on web.config, but I have no idea on how to make them.

In addition, what would be the changes (if any): 1 - At my DNS zones for both domains 2 - Azure website domain configuration.

Thank you,

Igor

2

2 Answers

1
votes

I think you will need to assign hostname www.anotherexample.com to the same wordpress site that hosts www.example.com by following instructions here.

After that you will need to add a redirect rule to your site that will redirect requests www.anotherexample.com to www.example.com:

<rewrite>
    <rules>
        <rule name="Redirect host name" patternSyntax="Wildcard" stopProcessing="true">
            <match url="*" />
            <conditions logicalGrouping="MatchAll">
                <add input="{HTTP_HOST}" pattern="www.anotherexample.com" />
            </conditions>
            <action type="Redirect" url="http://www.example.com/{R:1}" redirectType="Permanent" />
        </rule>
    </rules>
</rewrite>
0
votes

If your new site is WordPress based so it will very easy for you. just go to DNS management zone and add entry of domain forwarding and off Path Forwarding.No need to do any change in Azure site settings.

if you will turn On Path Forwarding even then WordPress will handle and it will not give any http error.

for example my site is http://subhashsingh.com and from http://study-desk.org you can get the same site even you will hit a wrong url like http://study-desk.org/12/new .