abigail Posted June 20, 2012 Share Posted June 20, 2012 I want to use absolute referencing for my css and images, because of the mod_rewrite issue in another post. So that if a user adds slash, "/", to end of url the style sheet and images would be found. When I use this for includes it works: define ('BASE_URI', '/home/advice10/public_html/'); But when I use it for css and images the browser doesn't find it. So I asked my webhost how to do absolute referencing and explained about when the slash, "/", is added to the end the browser doesn't find the style sheet, this is what they said: I believe that the absolute external reference you are looking for would be href="http://adviceofthequeen.com/minus/style/zw3c.css". Once again the internal relative reference resolves from the file that pulls up that style sheet, however if you are looking to go a directory up, for example: the location of your client is in "public_html/example" (domain.com/example) directory, and you want to use the style sheet in the "minus" directory, the reference you could use would be "../minus/style/zw3c.css" or the above mentioned "http://adviceofthequeen.com/minus/style/zw3c.css". The ".." stands for parent directory. You should never use the absolute reference of the server internally on a website. So the 2 issues I have with this are: 1) Should I use the http... for style sheet and images directories? 2) I use BASE_URI for my includes directory, and does that go against what webhost said: "You should never use the absolute reference of the server internally on a website."? Link to comment Share on other sites More sharing options...
Larry Posted June 20, 2012 Share Posted June 20, 2012 It technically doesn't matter whether you use the http or not. I normally just start with / if I want to create an absolute reference to CSS, images, JavaScript, etc. BASE_URI is a file reference to a file on the filesystem. You'd use it in a PHP script that includes another file. Filesystem reference are not meaningful in the HTML/Web browser, which is what your host is trying to convey. Link to comment Share on other sites More sharing options...
abigail Posted June 22, 2012 Author Share Posted June 22, 2012 I have it working now along with the mod_rewrite. Like you said, I started with '/'. But I think there was a reason I didn't do it that way before and maybe it was because of subdomain. But it is working now anyway. Link to comment Share on other sites More sharing options...
Larry Posted June 22, 2012 Share Posted June 22, 2012 Great. Congrats! Link to comment Share on other sites More sharing options...
Recommended Posts