Jump to content
Larry Ullman's Book Forums

Recommended Posts

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."?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...