I've got my site in htdocs/mysite
which I'll be using to test/develop my website locally. Problem is, now all my URLs in my HTML/CSS need to begin with mysite
whereas they won't on the product environment. What's the best way around this? Is there something I can add to httpd.conf
to tell it anything in mysite
should be relative to mysite
? I'm still an apache noob, so please by detailed :)
views:
50answers:
1
+1
A:
Can you not just omit the preceding slash on each file reference? i.e.,
.myClass {
background-image: url(images/stuff.png);
}
I'm guessing you want something more substantial. Use an .htaccess file in the /mysite directory. All the info you need is here: RewriteBase
Brian Lacy
2010-02-05 00:37:01
No, can't omit it. CSS might be included from a subdirectory.
Mark
2010-02-05 01:01:29
The URL is relative to the CSS file's path, presuming your CSS file is external to the HTML document.
JasonTrue
2010-02-05 01:23:10
To be honest, I still don't see why simply using relative paths doesn't completely solve this issue. Use 'background-image: url(../images/stuff.png);' and '<link rel="stylesheet" href="css/styles.css" type="text/css" />'
Brian Lacy
2010-02-05 01:37:36
I agree. I verified the path worked fine as long as your relative path is correct in relation to the location of the CDs file.
JasonTrue
2010-02-05 06:25:48
that was supposed to be "css file". Thanks, iPhone!
JasonTrue
2010-02-05 17:26:46