You are here: Re: function call in .htaccess ? « PHP Language « IT news, forums, messages
Re: function call in .htaccess ?

Posted by Erwin Moller on 01/30/08 16:47

Peter wrote:
> (Apologies if this is sent twice, server issues it seems)
>
> Hi,
>
> I use something like this:
>
> RewriteRule ^(.*).png$ ../../templates/png_help/$1.png
>
> The links to png in my pages exist to this subdir, but in fact the png are
> located somewhere else in a templates directory.
> Now, I'm shuffeling folder layout, in part to support localisation etc.
> therefore the location might differ based on variables.
>
> Can I use external variables somehow in .htaccess ?
> E.g. {TARGET_DIRECTORY}/templates/png_help/$1.png

Hi Peter,

If I were you I would repost this in alt.apache.configuration

>
> Or call a function that outputs the directory ?
> e.g. <?php echo DIR ?>/templates/png_help/$1.png

That will surely not work.
You have no PHP variables available in your apache configuration.


>
> or .... ???
>

Maybe you can solve this with a rewriterule, but I don't know how.
Alternatively you can simply call a PHPscript that returns the png.

From HTML, instead of:
<img src="templates/png_help/example.png">

you write:

<img src="mypngscript.php?png=example.png">

And let mypngscript.php handle all complex path stuff.

Regards,
Erwin Moller

 

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

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