How do I set up an .htaccess file to redirect requests to another folder on another domain? I don't want the links to break, I just want them to go elsewhere. Say mysite.com/image.jpg would redirect to site2.com/images/image.jpg.
From stackoverflow
-
This should help:
Redirect 301 / http://www.example.com/
-
In .htaccess (in Apache at least):
RewriteEngine On RewriteBase / RewriteRule ^images/(.*)$ http://www.yahoo.com/blah/$1 [R=302,L]
BlaM : Just as an additional hint: You need mod_rewrite installed on your server to use this. -
Now, what a big surprise, the official documentation has lots of useful examples, including what you are looking for. Yeah, it really sucks that Google is down so often.
Chris : 'twas for me, earlier ;-) -
You could use mod_rewrite to redirect the request. If you want to redirect everything:
RewriteEngine on RewriteRule ^ http://other.example.com/images%{REQUEST_URI} [L]
And if you just want to redirect requests with a path that end in
.jpg
:RewriteEngine on RewriteRule \.jpg$ http://other.example.com/images%{REQUEST_URI} [L]
0 comments:
Post a Comment