Reputation: 31
ok so i have 2 domains site1.com/images/ (all images)
and I need to redirect the imgages link site1.com/images/ to site2.com/images/ so that when and when exp. site1.com/images/i.jpg is called it will look at site2.com/images/1.jpg and will find it. .this is basic duplicate of the site and i don't want to move images back and forward.
Upvotes: 0
Views: 3029
Reputation: 66415
If the websites are on the same server and running under the same user, you could use symbolic links between both websites.
E.g., create a symlink to /home/site2/public_html/images
in /home/site1/public_html/images
. Another option is using the Apache's Alias
directive:
Alias /images /home/site2/public_html/images
Put this in the vhost config of site1
.
Using redirection on Apache:
RedirectPermanent /images http://site2.example.com/images
The best way would probably fixing the HTML code pointing to one domain. If you cannot decide which domain should get the static content, create a subdomain (or even a different domain) to store the files.
Upvotes: 2
Reputation: 962
Put in your .htaccess on site1.com
Redirect permanent /images http://sites2.com/images
Upvotes: 5