I have frames page. In ("index.php"="main.php"+"button.php"+"banner.php") format. Using Apache 2.0.

The problem is, when I open a link in the home page, it opens in the main fram, as I want, but the address in the address-bar does not change, remains "http://localhost/site/index.php". Always stays as is.

What can be the mistake I have done?

Dani AI

Generated

Short version: the address bar stays on the frameset document. As described, the browser shows the top-level page URL (your frameset), so loading a different document into a child frame does not update the address bar. was correct that this is expected browser behavior.

Practical fixes you can apply now:

  • Force the link to replace the whole window by adding a target. This is the simplest:

    <a href="/site/main.php" target="_top">Open in full window</a>

    Or set a default for links from the frameset:

    <base target="_top">
  • Use JavaScript from the framed page to navigate the parent (only works if the frameset and framed document are same-origin):

    <script>
    top.location.href = '/site/main.php';
    </script>
  • If you want to change the address bar without unloading the frameset (modern approach, same-origin only), use the History API:

    <script>
    top.history.pushState(null, 'Page title', '/site/main.php');
    </script>

Notes and caveats: frames are deprecated and cause SEO, usability, and linking problems; consider replacing them with server-side includes, iframes, or a single-page approach. Using Apache mod_rewrite will not make a frameset update the browser URL by itself — mod_rewrite helps rewrite server URLs when you move away from frames, but it does not change frameset behavior in the browser (see the Apache mod_rewrite docs). For more on why frames are discouraged, see the MDN frameset documentation and the History API reference.

Recommended Answers

All 5 Replies

Ahmed
I think you better go to PHP forum.

My is problem has nothing concerned with PHP. I have a HTM version of the Website, and that causes the same problem. I think, it is becuse of frame pages.

Please, someone help me!

This is expected. The address bar shows the address of the page the user is on, which in the case of frames, is the frameset page. Since the user isn't navigating away from the frameset page, the URL in the address bar doesn't change.

What is the sollution?
How can I make the address of the page change?

There isn't a solution unless there's a problem: nothing "wrong" is happening. What you're experiencing is a by-product of the way frames work. I would suggest you go to the PHP forum and inquire about "URL rewrite" or mod_rewrite, or search the internet for those terms.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.