Hide php page name in URL

Reply

Join Date: Jul 2009
Posts: 12
Reputation: innocent.boys is an unknown quantity at this point 
Solved Threads: 1
innocent.boys innocent.boys is offline Offline
Newbie Poster

Hide php page name in URL

 
0
  #1
Jul 31st, 2009
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..!!
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 257
Reputation: samarudge is an unknown quantity at this point 
Solved Threads: 20
samarudge samarudge is offline Offline
Posting Whiz in Training

Re: Hide php page name in URL

 
0
  #2
Jul 31st, 2009
You meen the URLs look like
index.php?ID=1251341234
Etc.
My Blog, Life and everything that matters to me - SamRudge.co.uk

2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 885
Reputation: Airshow will become famous soon enough Airshow will become famous soon enough 
Solved Threads: 127
Airshow's Avatar
Airshow Airshow is offline Offline
Practically a Posting Shark

Re: Hide php page name in URL

 
0
  #3
Jul 31st, 2009
I can think of three reasons:
  1. Pages are served within a Frameset
  2. Content is controlled by the quesry string (as per samarudge's post above)
  3. URL is "mapped" (as with eg. Zend Framework's "rewrite router")
Airshow
50% of the solution lies in accurately describing the problem!
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 94
Reputation: sikka_varun is an unknown quantity at this point 
Solved Threads: 11
sikka_varun's Avatar
sikka_varun sikka_varun is offline Offline
Junior Poster in Training

Re: Hide php page name in URL

 
0
  #4
Jul 31st, 2009
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:

  1. <?php
  2.  
  3. $page = $_GET['page'];
  4.  
  5. switch($page)
  6. {
  7. case 'home': include("home.php");
  8. break;
  9. case 'about': include("about_us.php");
  10. break;
  11. case 'services': include("services.php");
  12. break;
  13. case 'clients': include("clients.php");
  14. break;
  15. case default: include("home.php");
  16. break;
  17. }
  18. ?>
VâRûN
---Happy to Help---
sikka_varun@yahoo.com
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 120
Reputation: sam023 is an unknown quantity at this point 
Solved Threads: 2
sam023 sam023 is offline Offline
Junior Poster

Re: Hide php page name in URL

 
0
  #5
Aug 6th, 2009
Originally Posted by sikka_varun View Post
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:

  1. <?php
  2.  
  3. $page = $_GET['page'];
  4.  
  5. switch($page)
  6. {
  7. case 'home': include("home.php");
  8. break;
  9. case 'about': include("about_us.php");
  10. break;
  11. case 'services': include("services.php");
  12. break;
  13. case 'clients': include("clients.php");
  14. break;
  15. case default: include("home.php");
  16. break;
  17. }
  18. ?>

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
  1. <?php
  2. $page = $_GET['page'];
  3. switch($page)
  4. {
  5. case 'welcome': include("welcome.php");
  6. break;
  7. case 'view': include("view.php");
  8. break;
  9. case 'payment': include("payment.php");
  10. break;
  11. case 'tariff': include("location:traiff.php");
  12. break;
  13. case 'changepass': include("changepass.php");
  14. break;
  15. default : include("welcome.php");
  16. break;
  17. }
  18.  
  19. ?>

and in menu.php (this menu bar of the page)
i did this
  1. <ul id="menu" class="cleaning-box">
  2.  
  3. <li><a href="direct.php?page=welcome">Home</a></li>
  4. <li><a href="direct.php?pagepage=view">Call History</a></li>
  5. <li><a href="direct.php?page=payment">Payments</a></li>
  6. <li><a href="direct.php?page=tariff">Tariff</a></li>
  7. <li><a href="direct.php?changepass.php">Change Password</a></li>
  8. <li><a href="logout.php">Logout</a></li>
  9. </ul>
  10. </body>
  11. </html>

kindly tell where i m wrong..!!! i m unable to get the result..!!
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 43
Reputation: edwinhermann is an unknown quantity at this point 
Solved Threads: 9
edwinhermann edwinhermann is offline Offline
Light Poster

Re: Hide php page name in URL

 
0
  #6
Sep 21st, 2009
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:

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

and

  1. <li><a href="direct.php?changepass.php">Change Password</a></li>
should be
  1. <li><a href="direct.php?page=changepass">Change Password</a></li>
Last edited by edwinhermann; Sep 21st, 2009 at 5:34 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 714 | Replies: 5
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC