I am using bootstrap and created a dropdown menu. The main item is a link that works on the homepage but not on the subpage.

Here's my code:

<!-- language: lang-html -->
<li>
  <a href="/preview/#design-centre" class="dropdown-toggle scroll" 
     data-toggle="dropdown" data-hover="dropdown">
    Design Centre <i class="fa fa-angle-down"></i>
  </a>
  <ul class="menulist dropdown-menu">
    <li><a href="/preview/#design-centre">Overview</a></li>
    <li><a href="/preview/design-centre.php?action=video-testimonials">Video Testimonials</a></li>
    <li><a href="/preview/design-centre.php?action=meet-the-team">Meet The Team</a></li>
    <li><a href="/preview/design-centre.php?action=faq">FAQ</a></li>
    <li><a href="/preview/design-centre.php?action=contact-us">Contact Us</a></li>
  </ul>
</li>

When I click on Design Centre, it does not do anything on a subpage, but on a homepage it does, all other links that are in the navigation but are not dropdown menus work.

This should work fine. What you're trying to do has nothing to do with Bootstrap, per se, and is merely trying to use anchor links to navigate both within a document and also to fragments of another document. This is just standard HTML markup.

The fragment identifier is the portion of the URI that:

refers to a location within a resource

As long as those links work individually, they should work in your code.

Some things that might mess it up:

  • If you're using relative URLS, then the address will change based on where in the navigation you are. Since you are starting your href address with a slash, this does not appear to be the case.

  • You can try converting the following line:

      <li><a href="/preview/#design-centre">Overview</a></li>
    

To this (assuming your root page is index.html):

    <li><a href="/preview/index.html#design-centre">Overview</a></li>

Sometimes the page can be inferred by your asset pipeline, but it's generally better to be explicit.

Here's a working example in plunker

And here's a runnable version that includes a main page and subpage with working fragments

Beyond that, we'd need more info to diagnose. If it still doesn't work, try to fork the plunker and add any changes that visibly show the issue.