PHP如何打开page1,重定向到page2并在divDOM中显示page1?

PHP如何打开page1,重定向到page2并在divDOM中显示page1?,php,javascript,jquery,redirect,Php,Javascript,Jquery,Redirect,我有很多子页面,有URL像www.domain.com/sub/page1.phpwww.domain.com/sub/page2.php。。。现在,当我在浏览器中键入url时。它们都重定向到www.domain.com/sub/index.php,当前子页面将显示在index.php中的div-dom中 我的知识非常有限。我只知道jqeury.load和php头位置。但是很难重定向到index.php,然后告诉index.php,这是当前的子页面,然后执行jqeury.load 还有一个注意事

我有很多子页面,有URL像
www.domain.com/sub/page1.php
www.domain.com/sub/page2.php
。。。现在,当我在浏览器中键入url时。它们都重定向到
www.domain.com/sub/index.php
,当前子页面将显示在
index.php
中的div-dom中

我的知识非常有限。我只知道
jqeury.load
php头位置
。但是很难重定向到
index.php
,然后告诉
index.php
,这是当前的子页面,然后执行
jqeury.load

还有一个注意事项:也应该考虑
SEO
。也许
jqeury.load
对搜索蜘蛛来说不好。也许应该使用
hash
url

所以我请求帮助。有人能给我一些好的建议吗?还是简单的例子

谢谢。

在每个PHP文件(例如
page1.PHP
)中使用以下代码:

<?php
if(!defined('INCLUDE')) {
    header('Location: index.php?site=' . $_SERVER['PHP_SELF']); //Send the user to the index.php page
    die();
}
?>
Insert the content you want here...
在每个PHP文件(例如
page1.PHP
)中使用以下代码:

<?php
if(!defined('INCLUDE')) {
    header('Location: index.php?site=' . $_SERVER['PHP_SELF']); //Send the user to the index.php page
    die();
}
?>
Insert the content you want here...

重定向是如何完成的?通过javascript?还是Apache ModRewrite?@ArtoAle,我输入了
标题位置
,但没有成功。那么javascript呢?或者Apache ModRewrite。一切都很好,只是得到了效果。谢谢。如果你将一个页面加载到另一个页面,iFrame会不会工作得更好?重定向是如何完成的?通过javascript?还是Apache ModRewrite?@ArtoAle,我输入了
标题位置
,但没有成功。那么javascript呢?或者Apache ModRewrite。一切都很好,只是得到了效果。谢谢。如果你把一个页面加载到另一个页面,iFrame会不会工作得更好?很好的方法。还有一个问题:如果
page1.php
在文件夹名
files
(files是web根目录中的子文件夹)中,如何编写
header('Location:
)?非常感谢。它应该是
header('Location:../index.php
。您也可以对子文件夹中的文件使用
header('Location:/sub/index.php
)(称为
files
)和web root.great方法。还有一个问题:如果
page1.php
在文件夹名
files
(files是web root中的子文件夹)中,如何编写
标题(
位置:
?非常感谢。它将是
标题(
),您也可以使用
标题('Location:/sub/index.php
用于子文件夹(称为
文件
)和web根目录中的文件。