Forum Moderators: phranque
I thought to myself that I'll just setup a rewrite rule and have the flash file think its loading a file on the local server, but really the server will be pulling it from the remote one.
I added this line to my .htaccess file:
RewriteRule ^image/(.*\.jpg)$ http://www.example.com/$1 [nc]
I still get the errors in flash, and worse, if I try to access this file on my own server, for example, going to /image/test.jpg, the server is redirecting me to http://www.example.com/test.jpg.
But I'm not telling it to use a redirect. There' isn't anything like [r=301] in there!
What am I doing wrong?
There' isn't anything like [r=301] in there!But a fully-qualified domain which is not the current host, this implies an external redirection.
Apache manual [httpd.apache.org]:
Absolute URL
If an absolute URL is specified, mod_rewrite checks to see whether the hostname matches the current host. If it does, the scheme and hostname are stripped out and the resulting path is treated as a URL-path. Otherwise, an external redirect is performed for the given URL.
I rewrote my statement to:
RewriteRule ^image/(.*\.jpg)$ http://www.example.com/$1 [P,NC]
I even put my flags in capital letters, and in the same order as used in the manuel, [httpd.apache.org...]
From reading your post it seemed like without the flag, it would automatically redirect because it was a different domain, and that I needed the P flag, but is there anything else that I need? Because my new flags don't seem to work.
You should get errors if there's sthg. wrong.
403 if mod_proxy is n/a
500 if mod_proxy is available, but mod_proxy_http is not available (apache 2.1+).
From reading your post it seemed like without the flag, it would automatically redirect because it was a different domain
I added this line to my .htaccess file
Unless you have other working RewriteRules already in that file, you will likely need to add either both of these lines above your rule, or at least add the second line. The only way to find out whether both are required is to test -- preferably with a very simple rule, such as a redirect from "foo.html" to google.com or similar.
Options +FollowSymLinks
RewriteEngine on
[edited by: jdMorgan at 3:17 pm (utc) on Feb. 19, 2009]