TimFernihough
Programmer
- Dec 16, 2008
- 3
I have two separate domains owned by the same company. There is a dynamic product list present on one of the sites, including pictures for each product. The second website draws from the same database remotely and displays the same product list. Since the product images are stored as files on the first domain, I have used mod_rewrite to link all image requests on domain 2, back to domain 1. For company political reasons, I cannot have a user visiting domain 2, know that the image is actually hosted on domain 1.
All normal rewriting (staying on the same domain) works just fine. However, the rewriting for images from Domain 2 to Domain 1 is experiencing some issues. Although it correctly resolves to the image, the address bar does not retain the rewritten URL. Rather, it simply changes to the URL that is being linked to like it is redirecting rather than rewriting. My .htaccess code is as below:
I tried this with and without the [L] and have had no luck. It always reverts to the original URL and does not retain the rewritten URL. Is this because you cannot rewrite to an external domain? If so, does anyone have a suggestion of a workaround to prevent the user from seeing the native URL? I realize this might be an inherent side effect of mod_rewrite due to potential malicious applications, but I have a unique scenario where both domains are owned by the same company.
Any help that anyone can suggest would be greatly appreciated.
Tim Fernihough
All normal rewriting (staying on the same domain) works just fine. However, the rewriting for images from Domain 2 to Domain 1 is experiencing some issues. Although it correctly resolves to the image, the address bar does not retain the rewritten URL. Rather, it simply changes to the URL that is being linked to like it is redirecting rather than rewriting. My .htaccess code is as below:
Code:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^catalogue_images/(.+)$ [URL unfurl="true"]http://www.domain2.com/$1[/URL] [L]
I tried this with and without the [L] and have had no luck. It always reverts to the original URL and does not retain the rewritten URL. Is this because you cannot rewrite to an external domain? If so, does anyone have a suggestion of a workaround to prevent the user from seeing the native URL? I realize this might be an inherent side effect of mod_rewrite due to potential malicious applications, but I have a unique scenario where both domains are owned by the same company.
Any help that anyone can suggest would be greatly appreciated.
Tim Fernihough