Htaccess code for 301 redirect of all images in image folder to other domain
Hello
A cartoonist friend is moving a portion of his site to another domain.
He currently has lots of fans who are linking to his cartoons (animated gifs) from places such as facebook, etc.
He doesn't want to have any of the images on his current domain, so -- if possible -- I want to put a htaccess file in his image directory pointing (310??) to an image folder in his other domain -- where I will move the images to. I will delete all of the images in the old domain image folder.
Yes, you would use a redirect with a match.
The problem is that whether it is redirected or accessed on the current domain the viewer will not know the difference. Eventually this domain will have to be let go so all those who link tote images will have an issue either way the question, whether it is now or later.
Anthropomorphic_Personification
You are better off catching all hits on the old domain with a php page that pops up a message and then redirects after a few seconds. Something like "This page has moved from www.olddomain.com to www.newdomain.com, please update any links and bookmarks you used to access the site. You will automatically be redirected in 15 seconds if this does not happen please click here."
The ideal solution for reasons beyond the scope of this question is the images must be moved to a different domain.
Currently thousands of visitors have IMG links to his cartoons. He doesn't want the IMG links to be broken.
So it is not just a matter of redirecting a visitor to a new page, I am trying to prevent broken image IMG links (not text links) from showing up all over the net on my friends fan pages (facebook, myspace, blogs, etc.)
Arnold, what is a "redirect with a match" And can you give an example.
Is is an htaccess with a wildcard saying that all images in this folder on this domain are now in this new domain and folder" -- and thus preventing a broken image?
Note: My friend will be keeping his "old" domain -- he just needs the images in his image folder to be moved to new domain. The images in his image folder will be deleted on his old domain. The only thing that will be in his old image folder would be the single htaccess file -- assuming that it will work as I hope.
Ideally the htaccess solution will have a wild card in it so that I don't have to list each of the images.
Yes, in the images folder you would create a .htaccess file with the below directive.
Make sure the permissions on the .htaccess is 644 read/write owner, read group and read others.
also you have a space in the http:// www which should not be there which looks it came from my example
https://www.experts-exchange.com/OS/Linux/A_8789-How-websites-can-be-redirected.html