Jump to content

Recommended Posts

How can I use an include file that has a list of links in any directory at my website without breaking those links?

You can see it in action here...

The links in this directory work...

https://www.billelgin.com/primary-directory/

The links in this directory (being created from the same include file) do not work...

https://www.billelgin.com/primary-directory/subsection-one/

Obviously the problem is the include file is being called from different directories, so it's breaking the relative path links in the include file, but what can I do to fix it?

You can download the example directory structure here...

https://www.billelgin.com/EXAMPLE.zip

Use root-relative links.

<a href="/primary-directory/subsection-one/">Subsection One</a>

The leading slash means the link is relative to the root of the domain name so it doesn't matter which directory you're in.

 

I swear I tried that. At least I thought that I did.

But guess what, I made the change that you suggested and it's working perfectly. I uploaded the updated include file in case anyone else wants to see it working now.

I can't tell you how much I appreciate it. Thank you!

Edited by MysticKnight
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.