You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Carlos <Ca...@pbsinet.com> on 2003/02/06 20:27:44 UTC

[users@httpd] Searching files in a particular directory by default????

Can one configure Apache Web Server to search in a particular directory for
files of a particular type if a browser cannot find a file of this type from
the src specification of an image tag?  I have HTML pages that have the
following type of src information in image tags: src=
"Folder_Name/file.jpg".  My browser fails to find the image files even
though the Folder_Name directory resides under the DocumentRoot directory.
On the other hand, If I change the src info to src="/Folder_Name/file.jpg",
my browser can find the file.jpg with no problems.  Hence I thought that a
way around this problem could be to configure the server so that it looks
for image files in a directory by default if the browser fails to find the
file in the path that the src defines.

I have so far changed the src information in the html files to src=
"/images/Folder_Name/file.jpg" and of course created the Folder_Name under
the DocumentRoot/images/ directory.  This works fine for the few html files
that I have but I expect to have to manage many more of these files and I do
not want to change the src information in all of them

Thanks in advance for your help.

Re: [users@httpd] Searching files in a particular directory by default????

Posted by Joshua Slive <jo...@slive.ca>.
On Thu, 6 Feb 2003, Carlos wrote:

> Can one configure Apache Web Server to search in a particular directory
> for files of a particular type if a browser cannot find a file of this
> type from the src specification of an image tag?

This can be done either using mod_rewrite (use a RewriteCond which tests
for the existence of the file using -f) or an ErrorDocument pointing to a
cgi script which emits a Location: header.

But I recommend you instead fix your broken urls.  Other solutions will be
much less performant, and will prevent your files from being properly
cached, etc.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org