HTML relative links with URL Rewrite
Posted
by Adam Kiss
on Stack Overflow
See other posts from Stack Overflow
or by Adam Kiss
Published on 2010-05-19T06:48:37Z
Indexed on
2010/05/19
6:50 UTC
Read the original article
Hit count: 238
html
|relative-path
I have quickie:
When you code/develop themes, how do you link to various files in your html/css code?
Example:
We at our firm use mostly <base target="http://whatever">
in our main template and then just <img src="./images/file.png">
in our html, "/category/page"
as links and something alike in our css.
However, when testing on different machines, we use ip address rather than localhost on main dev station of coder, so all base links don't work (because localhost goes to viewing machine, not coder's, in our network).
Same thing happens when updating pages - on dev server, we have to edit base target, so browsing site won't take us to live site - this part is actually rather simple PHP (if ... echo else echo something else
), but it still not solve problem of more coding-testing problems.
So, my question is, how do YOU solve it? How do you use relative links, which basically don't care for what domain is the page on and don't care for url rewrite? (because ../images/
is different for /
and different for /something/somethingElse/page
)?
© Stack Overflow or respective owner