我的首页檔名是index.htm ,并用frame把index.php 加入到index.htm内
我不想用户看到绝对路径
我希望用户输www.xxx.com/index.php或www.xxx.com/index.php?id=123&s=xxx...的时候
自动转回www.xxx.com
能做到吗?Index.htm内容
<frameset framespacing="0" border="0" rows="*" frameborder="0">
<frame name="main" src="http://www.xxx.com/index.php" scrolling="yes">
<noframes>
<body onmouseover="self.status='';">
</body>
</noframes>
</frameset>
</html>
我不想用户看到绝对路径
我希望用户输www.xxx.com/index.php或www.xxx.com/index.php?id=123&s=xxx...的时候
自动转回www.xxx.com
能做到吗?Index.htm内容
<frameset framespacing="0" border="0" rows="*" frameborder="0">
<frame name="main" src="http://www.xxx.com/index.php" scrolling="yes">
<noframes>
<body onmouseover="self.status='';">
</body>
</noframes>
</frameset>
</html>
<script language="javascript">
<!--
if(window.parent.document.location.href!='http://www.xxx.com'){
document.location='http://www.xxx.com';
}
-->
</script>
这个页面内是否可以加:head("http://www.xxx.com");
楼主试一下,应该是可以的,我用过!
可以不修改index.php 的情況下做到嗎?
可以,但是最简单就是修改index.php,使用Apache(或IIS)、htaccess(Apache的文件)的ReWrite的URL重写机制,自动跳转。即是不从文件入手,从服务器处理URL地址入手。
但是肯定無法修改index.php
htaccess(Apache的文件)的ReWrite
具體修改方法可否提供一下
启动Rewrite。把:
#LoadModule rewrite_module modules/mod_rewrite.so
改成(注意,去掉#):
[code=INIFile]LoadModule rewrite_module modules/mod_rewrite.so
RewriteEngine on
RewriteRule ^/index.php /Rewrite.php [R][/code]这是最简单的,在根目录建一个Rewrite.php文件,内容为:
<?php
header("location: index.htm");//跳转。
?>
但效果不是我想的 可能我表達錯了我希望用戶"直接"輸入www.xxx.com/index.php或www.xxx.com/index.php?id=123&s=xxx...時
彈回首頁但現在首頁不論按什麼連結都會彈回首頁努力中...謝謝
一般用户不会理会路径
那个路径是你自己的程式产生的
如果想用户看不到档案名及参数
你需要重新设计全个网站的结构
令他能配合URLRewrite如果你对URLRewrite及http没什么概念
而网站又不是很小
我估计你最少要花一个月以上时间...
即使是别人的站,也能重写成你的,且IE地址仍是你的域名因为apache里有有代理服务器,自动转换
嗯....
利用frame的方法
把index.php 加入到index.htm内
一般用戶輸入www.xxx.com 不論連結什麼地方 網址列都顯示www.xxx.com
但只要用戶輸入www.xxx.com/index.php
便能看到絕對路徑
那麼frame的方法形同虛設嗎??
不懂的人...根本不会理会这些东西URLRewrite 一般都只是想令URL结构变得容易理解
但要全面,需要网站结构的配合不是的话,光写rewrite rule都可以写死人
效能更是低得要命