Jump to content

[SOLVED] Why is Dreamweaver putting a "/" in front of all my relative links


Recommended Posts

It's perfectly fine, it'll work both ways. If you treat your root folder as your website. Such as www.mysite.com, if you keep the link as images/image.gif logically it would turn out as www.mysite.comimages/image.gif but that won't happen because if you type in a URL as www.mysite.com once it has loaded you'll see it as www.mysite.com/ so if you add the "/" you are doing that for it, so you'll get the same result both ways: www.mysite.com/images/images.gif.

 

Sam

Link to comment
Share on other sites

  • 2 weeks later...

Yep; It seemed to mess up my links...

 

There are 3 ways to make relative links:

 

yourpage.htm

/yourpage.htm

./yourpage.htm

 

The last one is the one I use most frequently because it also allows you to go BACK a directory RELATIVELY speaking...

 

For example:

 

if you had a file in 'folder1' and you wanted to relatively link to a file at the same level as folder 1 in 'folder2', it'd look like this:

 

../folder2/file.htm

 

You can use as many dots as you like depending on how far back you'd like to go.

 

That's all there is to it!

 

Good Luck,

Malev.

Link to comment
Share on other sites

I understand how the relative links work but sometimes as a designer I create a specified folder for my clients. So it's like mySite/theirFolder/theirFile.htm

 

Dreamweaver is adding that "/" in front of everything and when I upload files they aren't showing up right. I have to manually go back into the page and delete every "/" that is in front of a relative link! I've been doing this for years with Dreamweaver Mx 2004 and this has just happened all of a sudden. I must have changed some option not realizing it in Dreamweaver. How can I change it back so there's no "/" in front of the links?

 

ARRRGGG! ... (lol)

Link to comment
Share on other sites

That's what I'm trying to say.

 

Instead of typing 'index.htm' initially, just type ./index.htm.

 

Dreamweaver doesn't change ./ relative links.... I too had the problem of it changing from index.htm to /index.htm which was pretty annoying. Also, if you type say 'index.htm' into the 'link' box in dreamweaver; it's better if you type <a href="index.htm">text</a> rather than doing it through the WYSIWYG (WhatYouSeeIsWhatYouGet) editor.

 

Also, if you click the little folder icon in the properties tab next to link and the target button, there is a dropdown menu at the bottom of the dialogue saying 'Relative To:' and you can choose 'Site Root' or 'Document'. You'll probably want to select Site Root.

 

Working yet?

Link to comment
Share on other sites

Also, if you click the little folder icon in the properties tab next to link and the target button, there is a dropdown menu at the bottom of the dialogue saying 'Relative To:' and you can choose 'Site Root' or 'Document'. You'll probably want to select Site Root.

 

That worked. It was set relative to the site root. When I changed it to document it dropped the "/".

 

Thanks for your help!

Link to comment
Share on other sites

Lol, It got pretty annoying for me too; though now I prefer to type my own code as I've progressed in skill and realised that WYSIWYG Editors limit your creativity although they're handy if you're a beginner or if you're short for time. I still use Dreamweaver to type my own code as I like the Colour Coding and Syntax Corrections.

 

By the way; I was wrong about something.

 

If you would like to go 2 folders up, you do NOT add an extra dot, but you add ../ to the preexisting relative link.

 

EG:

 

If you wanted to access a file but it was UP by 2 folders and in a different folder and the name of the file is bob.jpg, you'd do it like this:

 

../../diffolder/bob.jpg

 

so if it was 3 folders back:

 

../../../diffolder/bob.jpg

 

I learned that when I was having troubles today.

 

Regards,

Dan.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.