943,789 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 2896
  • PHP RSS
Jul 31st, 2009
0

Hide php page name in URL

Expand Post »
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..!!
Similar Threads
Reputation Points: 11
Solved Threads: 1
Newbie Poster
innocent.boys is offline Offline
12 posts
since Jul 2009
Jul 31st, 2009
0

Re: Hide php page name in URL

You meen the URLs look like
index.php?ID=1251341234
Etc.
Reputation Points: 26
Solved Threads: 31
Posting Whiz
samarudge is offline Offline
354 posts
since May 2008
Jul 31st, 2009
0

Re: Hide php page name in URL

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
Sponsor
Reputation Points: 318
Solved Threads: 358
WiFi Lounge Lizard
Airshow is offline Offline
2,526 posts
since Apr 2009
Jul 31st, 2009
0

Re: Hide php page name in URL

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 Syntax (Toggle Plain Text)
  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. ?>
Reputation Points: 11
Solved Threads: 12
Junior Poster in Training
sikka_varun is offline Offline
94 posts
since Dec 2008
Aug 6th, 2009
0

Re: Hide php page name in URL

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 Syntax (Toggle Plain Text)
  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
php Syntax (Toggle Plain Text)
  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
php Syntax (Toggle Plain Text)
  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..!!
Reputation Points: 11
Solved Threads: 6
Junior Poster
sam023 is offline Offline
164 posts
since Jun 2009
Sep 21st, 2009
0

Re: Hide php page name in URL

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:

php Syntax (Toggle Plain Text)
  1. <li><a href="direct.php?pagepage=view">Call History</a></li>
should be
php Syntax (Toggle Plain Text)
  1. <li><a href="direct.php?page=view">Call History</a></li>

and

php Syntax (Toggle Plain Text)
  1. <li><a href="direct.php?changepass.php">Change Password</a></li>
should be
php Syntax (Toggle Plain Text)
  1. <li><a href="direct.php?page=changepass">Change Password</a></li>
Last edited by edwinhermann; Sep 21st, 2009 at 5:34 am.
Reputation Points: 52
Solved Threads: 27
Junior Poster
edwinhermann is offline Offline
134 posts
since Sep 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Encrypt php code
Next Thread in PHP Forum Timeline: unexpected T_VARIABLE





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC