tags:

views:

50

answers:

1

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 :)

+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
No, can't omit it. CSS might be included from a subdirectory.
Mark
The URL is relative to the CSS file's path, presuming your CSS file is external to the HTML document.
JasonTrue
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
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
that was supposed to be "css file". Thanks, iPhone!
JasonTrue