Rewrite directory to domain

I am struggling with rewriting .htaccess, can someone point me in the right direction?

I want to be able to rewrite all requests to

www.domain.com/images to images.domain.com (the subdomain is on a different server), keeping any file and subfolder names unchanged.

Therefore, requests to www.domain.com/images/folder1/image1.jpg will receive an image from images.domain.com/folder1/image1.jpg

Thank.

+5
source share
1 answer

Use this rule:

RewriteEngine on
RewriteRule ^images/(.*)$ http://images.domain.com/$1 [L,R=301]
+6
source

All Articles