0

I have a link displaying an image on my site which is from www.somedomain.com/image.jpg

How can I mask the domain so that it is www.mydomain.co.uk/image.jpg ?

Would this be done using mod_rewrite?

Thanks

asdf1234
  • 127
  • 4
  • 10

1 Answers1

0

This will rewrite all calls from your domain.

RewriteCond %{HTTP_HOST} ^www.somedomain.com$
RewriteRule ^(.*)$ http://www.mydomain.co.uk/$1 [R=301,L]

If you want to redirect all images, you can specify them by extension in the regex.

RewriteCond %{HTTP_HOST} ^www.somedomain.com$
RewriteRule ^(.+\.(?:jpg|gif|png))$ http://www.mydomain.co.uk/$1 [R=301,L]
Georgi
  • 320
  • 4
  • 18