You are here: Re: including image, js, css from private dir « All PHP « IT news, forums, messages
Re: including image, js, css from private dir

Posted by juglesh on 11/25/05 17:45

juglesh wrote:
> hello, here is my dir structure:
>
> /private
> mainaction.php
> img.jpg
>
> /public_html
> index.php
>
> in index.php, I include mainaction.php. In mainaction.php, i want to
> have
> <img src='<?php insertImageHere ?>' > and have img.jpg show in
> index.php. I need to do this for a .js file and a .css as well.

Ok, this turned out to be an Apache question. You need to use an Alias
to tell apache what dir to look in, despite what the browser is asking
for. And, <Directory> to allow the access. The following code goes in
apache's httpd.conf config file, in my case, under the line that says
<IfModule mod_alias.c>

Alias /test/ "c:/my documents/_websites/guava/private/test/"

<Directory "c:/my documents/_websites/guava/private/test">
Order allow,deny
Allow from all
</Directory>

That will make it so <img src='/test/image.jpg' > gets the image from
the private dir, not from a folder in the web root. Works for .js,
..css, whatever.

--
j

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация