On the one hand mod_rewrite allows me to make userfriendly urls redirecting requests to proper script but on the other I can't use relative links because they will point at nonexistent files.
A little example:
mod_rewrite redirects request
http://site.ru/param/one/page.html
at http://site.ru/script.php
while I have "myimg.jpeg" file at the same folder I can't use relative link <img src="myimg.jpeg />
cause in that case the browser will try to load img from the "http://site.ru/param/one/myimg.jpeg" address.
Mod_rewrite kullanırken img / css / js dosyalarının doğru yolu işlemek için yaygın bir uygulama nedir?
I have 2 ideas about the realization:
1) to add base tag like that <base href="http://site.ru/" />
2) to define a variable with the baseUrl and then use it while rendering src attributes like that:
$baseUrl = 'http://site.ru/';
...
echo '<img src="' . $baseUrl . 'myimg.jpeg" />
Hangi en iyi çözümdür ve sorunu çözmek için başka yollar var mı?