PHP如何打开page1,重定向到page2并在divDOM中显示page1?
我有很多子页面,有URL像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 还有一个注意事
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根目录中的文件。