954,576 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Hide php page name in URL

i m new to php.. i have seen in many php sites...!! if jump from one page to another... it does shows the page name..!! URL remains at Index page..!! Only page changes..!!

as i work..!! if i jump from one page to another..! Url also changes from page to page..!!
.
.
i just want tht i dont to show which i m calling in URL..!!
.
.
i hope everyone understand what exactly i want to say..!! :)
.
.
thanks in advance..!! :)

innocent.boys
Newbie Poster
12 posts since Jul 2009
Reputation Points: 11
Solved Threads: 1
 

You meen the URLs look like
index.php?ID=1251341234
Etc.

samarudge
Posting Whiz
359 posts since May 2008
Reputation Points: 26
Solved Threads: 31
 

I can think of three reasons:Pages are served within a Frameset
Content is controlled by the quesry string (as per samarudge's post above)
URL is "mapped" (as with eg. Zend Framework's "rewrite router")
Airshow

Airshow
WiFi Lounge Lizard
Moderator
2,683 posts since Apr 2009
Reputation Points: 321
Solved Threads: 372
 

You can use a couple of things with this.

Read about URL Rewriting (a bit advanced thing, but you can try). Or search on this forum, you will get somethng about URL Rewriting using .htaccess.

Other option, where only index page shows, you can put your pages dynamic.
For eg: you have 4 pages, Home,About Us, Services, Clients

So you can have your url as :
index.php?page=home
index.php?page=about
index.php?page=services
index.php?page=clients

For php, you can create your pages separately and then you can create an index page with the below like code:

<?php

$page = $_GET['page'];

switch($page)
{
    case 'home': include("home.php");
    break;
    case 'about': include("about_us.php");
    break;
    case 'services': include("services.php");
    break;
    case 'clients': include("clients.php");
    break;
    case default: include("home.php");
    break;
}
?>
sikka_varun
Junior Poster in Training
94 posts since Dec 2008
Reputation Points: 11
Solved Threads: 12
 

You can use a couple of things with this.

Read about URL Rewriting (a bit advanced thing, but you can try). Or search on this forum, you will get somethng about URL Rewriting using .htaccess.

Other option, where only index page shows, you can put your pages dynamic. For eg: you have 4 pages, Home,About Us, Services, Clients

So you can have your url as : index.php?page=home index.php?page=about index.php?page=services index.php?page=clients

For php, you can create your pages separately and then you can create an index page with the below like code:

<?php

$page = $_GET['page'];

switch($page)
{
    case 'home': include("home.php");
    break;
    case 'about': include("about_us.php");
    break;
    case 'services': include("services.php");
    break;
    case 'clients': include("clients.php");
    break;
    case default: include("home.php");
    break;
}
?>


I m Sorry for late reply and thanx for ur Response..!!
.
.
I tried your code.... but i m unsuccessful up till now..!! :(
.
.
i made a direct.php

<?php
      $page = $_GET['page'];
      switch($page)
      {
        case 'welcome': include("welcome.php");
        break;
        case 'view': include("view.php");
        break;
        case 'payment': include("payment.php");
        break;
        case 'tariff': include("location:traiff.php");
        break;
        case 'changepass': include("changepass.php");
        break;
        default : include("welcome.php");
        break;
      }
  
      ?>


and in menu.php (this menu bar of the page)
i did this

<ul id="menu" class="cleaning-box">
            
<li><a href="direct.php?page=welcome">Home</a></li>
<li><a href="direct.php?pagepage=view">Call History</a></li>
 <li><a href="direct.php?page=payment">Payments</a></li>
        <li><a href="direct.php?page=tariff">Tariff</a></li>
        <li><a href="direct.php?changepass.php">Change Password</a></li>
        <li><a href="logout.php">Logout</a></li>
        </ul>
     </body>   
   </html>


kindly tell where i m wrong..!!! i m unable to get the result..!! :(

sam023
Junior Poster
164 posts since Jun 2009
Reputation Points: 11
Solved Threads: 6
 

Do the pages welcome.php, view.php, payment.php etc exist? You need to create them too.

By the way I noticed a few errors:

<li><a href="direct.php?pagepage=view">Call History</a></li>

should be

<li><a href="direct.php?page=view">Call History</a></li>


and

<li><a href="direct.php?changepass.php">Change Password</a></li>

should be

<li><a href="direct.php?page=changepass">Change Password</a></li>
edwinhermann
Junior Poster
141 posts since Sep 2009
Reputation Points: 67
Solved Threads: 29
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You