|
Posted by Alan J. Flavell on 02/01/84 11:46
On Sun, 30 Apr 2006, David Smithz wrote:
> I know I have access to .htaccess file with my host. Would that be
> somewhere, where I could make these changes?
Absolutely.
OK, let's start by trying to answer the question which you actually
asked.
The key to your redirection (as I hope you already read in the cited
supporting materials) could be some flavour of Apache Redirect
statement (in your .htaccess file, that is).
Redirect 301 /downloads http://www.example.com/downloads.htm
(301 is the permanent status already mentioned).
There are much more elaborate possibilities as one moves along,
including RedirectMatch with regular expressions; Redirect or
RedirectMatch inside <Files...> brackets; and, when simple solutions
fail, the "Swiss Army Knife" of rewriting URLs with mod_rewrite.
> Thanks and sorry for newbieishness of my question.
Not at all - we all have to start somewhere. The important point is
to want to learn ;-)
Peter McC has already suggested one alternative approach, namely to
turn downloads into a directory and put your page as its default
document - by convention index.htm or index.html ...
However, as exhibited, that was slightly sub-optimal, since navigating
to http://www.example.com/downloads is going to cause the web server
to redirect to http://www.example.com/downloads/ (with the trailing
"/") before it returns the default document.
*If* you decided to follow that approach, your references should
really be directly to http://www.example.com/downloads/ , so as to
avoid the unnecessary redirection transaction.
Another approach is to leave the web server to supply the missing
filename extension internally, without mentioning it on the URL.
In this case, no redirection transaction takes place: the document
is directly referenced by its URL http://www.example.com/downloads
despite the fact that your actual file, internal to the server, is
called downloads.htm (or .html, as the case may be). If you activate
MultiViews then you can have this and much else - but that would take
us off into lots of other detail.
Changing the subject again: you had a question to which I suspected
the answer was that your server was returning text/plain as the
content type. You didn't say anything in your followup to confirm or
deny that, but you might want to know how to influence that...
It's unlikely to be a good idea to set the server's default
content-type to be text/html, since in general there could be all
manner of unknown content types which it would be harmful to serve out
as text/html.
By convention, there's been two "schools of thought" about what to do
with unknown content-types. One is to serve them out as text/plain in
the hope that the reader will be able to make some sense of them
anyway. This can be particularly useful when there are miscellaneous
files lurking around with names like README or CHANGELOG or INSTALL.
But not so useful if the files of unknown type contain binary
executables and what not.
The other school of thought is to make the general default type to be
application/octet-stream (which in effect means "this is some bag of
bytes and I don't know what it's for, you might as well download it").
And then to take care to provide some special configuration for files
which, although they are without filename extensions, it's known that
they were meant to contain text, or some other definite content-type.
hope this is useful - it's really an open-ended topic, could go on and
on - but take what you need for now, and look to learn more when you
need it later.
[Back to original message]
|