Forwarding Files

R

Randy Yates

Hi Folks,

Is there a way to have a reference to, say, http://mysite1.org/file1.pdf to
be "forwarded" to http://mysite2.org/file2.pdf? I know I could write a cgi
script to reside on mysite1 to do this - I was wondering if there was a
"simpler," more html-centric way.
--
% Randy Yates % "She has an IQ of 1001, she has a jumpsuit
%% Fuquay-Varina, NC % on, and she's also a telephone."
%%% 919-577-9882 %
%%%% <[email protected]> % 'Yours Truly, 2095', *Time*, ELO
http://home.earthlink.net/~yatescr
 
A

Andy Dingley

Is there a way to have a reference to, say,http://mysite1.org/file1.pdfto
be "forwarded" tohttp://mysite2.org/file2.pdf?

Host on Apache

Configure this in .htaccess with a 301 or 302 (temporary) redirect.

Easy.


Search the group archives on mapping one domain onto another, for the
whole site. It's a fairly common question.
 
J

J.O. Aho

Randy said:
Hi Folks,

Is there a way to have a reference to, say, http://mysite1.org/file1.pdf to
be "forwarded" to http://mysite2.org/file2.pdf? I know I could write a cgi
script to reside on mysite1 to do this - I was wondering if there was a
"simpler," more html-centric way.

Best is server side redirections, if you use a proper web server like apache
you can do that.

You can make a php file with the extension pdf, which redirects to the right
file, but in that case you need to tell the web server to parse pdf files as
php scripts, which will slow your system down to a crawl each time people
access a real pdf file.

So the first option is the best one.
 
J

Jon Slaughter

J.O. Aho said:
Best is server side redirections, if you use a proper web server like
apache
you can do that.

You can make a php file with the extension pdf, which redirects to the
right
file, but in that case you need to tell the web server to parse pdf files
as
php scripts, which will slow your system down to a crawl each time people
access a real pdf file.

Except in the rar case that the pdf actually contains data that could be
parsed as php code...
 
R

Randy Yates

Andy Dingley said:
Host on Apache

Configure this in .htaccess with a 301 or 302 (temporary) redirect.

Easy.

I think I can do that - I have a VM hosted web account where I think I
"own" my own httpd.
Search the group archives on mapping one domain onto another, for the
whole site. It's a fairly common question.

I only wanted certain files within the "mysite1" domain to operate this way,
not all on the entire domain.
--
% Randy Yates % "Rollin' and riding and slippin' and
%% Fuquay-Varina, NC % sliding, it's magic."
%%% 919-577-9882 %
%%%% <[email protected]> % 'Living' Thing', *A New World Record*, ELO
http://home.earthlink.net/~yatescr
 
J

J.O. Aho

Randy said:
I think I can do that - I have a VM hosted web account where I think I
"own" my own httpd.


I only wanted certain files within the "mysite1" domain to operate this way,
not all on the entire domain.

Redirecting in Apache is quite simple, you can do that with regular
expressions or give the full path.

full paths:
RewriteEngine on
RewriteRule file1.pdf http://mysite2.org/file2.pdf

reg-expression:
RewriteEngine on
RewriteRule ^(/[c|d]/winnt/.*) http://127.0.0.1/$1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top