URL rewrite images to another domain without redirect

353 views Asked by At

I have main domain and I want to rewrite images form another one to main without redirect

Here is my code:

RewriteCond %{HTTP_HOST} ^www.mydomain\.eu$ [NC]
RewriteRule ^images/(.*)$ https://www.mydomain.cz/images/$1 [NC]

It always does 302 redirect.

Is there any way how to do this? I am using ISAPI_Rewrite, but I tried IIS 10 rewrite too, but I am not familiar with that and I wasnt successful at all

Thanks

1

There are 1 answers

0
Brando Zhang On

According to your description, I suggest you could try to below use url rewrite rule in the IIS.

            <rule name="Imported Rule 1" stopProcessing="true">
                <match url="^images/(.*)$" />
                <conditions logicalGrouping="MatchAll">
                  <add input="{HTTP_HOST}" pattern="^www.mydomain\.eu$" />
                </conditions>
                <action type="Rewrite" url="https://www.mydomain.cz/images/{R:1}" />
            </rule>