Jump to content

Same URL for all pages.


mmarif4u

Recommended Posts

Hi guys.

 

I wana to know some thing here.

I have a site where there are a lot of pages and directories.

 

For example site name is www.site.com (this is the index page).

Now if the user go to another pages for example click on the about link. How can i do this that the

site name appear in address bar remain the same as www.site.com not www.site.com/about.php

and so on for all pages.

 

Thanks in advance.

Link to comment
Share on other sites

You can use iframes.

 

<html>
<head>
<title>asdas</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<iframe src="index.php" name="body" frameborder="0" width="100%" height="100%">
Sorry, but your web browser does not support iframes
</iframe>
</body>
</html>

 

Each link mush have: target="body" before you end the first part of the tag.

 

You could also do:

 

<?php
//this file is index.php
$page = $_GET['page'];

if($page){
$dir = $_GET['dir'];

if(!$dir){
$file = "/home/yoursite/public_html/$page.php";
}else {
$file = "/home/yoursite/public_html/$dir/$page.php";
}

	if(file_exists($file)){
	include "$file";
	}else {
	include "/home/yoursite/public_html/main.php";
	}
}else {
include "/home/yoursite/public_html/main.php";
}
?>

 

In this case, your URLs must be:

 

About: /index.php?page=about

which will be: /home/yoursite/public_html/about.php

 

Something Else: /index.php?page=login&dir=user

which will be: /home/yoursite/public_html/user/login.php

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.