Base url

Hi there,

I’ve had a search through this forum, and I’m sure this question’s been asked before, but I can’t seem to find a satisfactory answer.

I’m testing out a site here:
http://www.mikes-lab.com/luxe/

Now in my HTML I have links like this <img src=“/images/blahblah.jpg”>, which ain’t workin, cos the server is looking in mikes-lab.com/images/, not mikes-lab.com/luxe/images.

So I’ve tried using <base href=“http://www.mikes-lab.com/luxe/”> in the head, but no joy.

I’ve also added a .htaccess file to /luxe/ and added the command:
DocumentRoot /path/to/public_html/luxe/

and I get a 500 Internal Server Error.

I’ve also tried
RewriteEngine on
RewriteBase /luxe/

no good.

Does anyone have any idea where I’m going wrong?

Cheers,
Mike

Ok, so after a bit of playing around, I realised that the trailing slash was messing me around.

The base href has a trailing slash on it http://mikes-lab/luxe[B]/[/B]
The links in my html were like so /css/styles.css, which was pointing to the root directory, I tool the leading slashes out and now everything works… except one thing. References in my stlye sheets aren’t loading. They are relative (…/images/image1.jpg), and don’t want to play with me.

Stumped.

Your supplied link to Mikes-Lab/luxe is missing .com

For your stylesheet try this:



<link rel="stylesheet" href="../css/styles.css">


With a little bit of luck your stylesheet image references should be correct :slight_smile:

Hi John_Betong,

Thanks for your reply.

Yeah, my bad about the .com, that was a typo.

<link rel=“stylesheet” href=“…/css/styles.css”>
references the stylesheet at www.mikes-lab.com/css/styles.css, rather than www.mikes-lab.com/luxe/css/styles.css

I’ll keep digging.

D’oh!

Just realised I hadn’t uploaded the images!

Feel like an absolute noob.

Ok, so just to clarify, if anyone comes a-looking at this post in the future, I’ve set up the head like so:


<head>
  <base href="http://www.mikes-lab.com/luxe/">
  <link rel="stylesheet" src="css/styles.css">
</head>

and everything works a charm.

:slight_smile: