如何隐藏文件名(.php) [英] how to hide file name (.php)

查看:86
本文介绍了如何隐藏文件名(.php)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我看到创建像index.php这样的导航很容易?id = 1,index.php?id = 2 ...然后你可以隐藏当前的但是我需要进一步的步骤(因为我见过很多),希望它很容易,如何隐藏文件名index.php以便上面的链接变得简单?id = 1,?id = 2 ...如果是这样,那就太棒了:)

解决方案

好的,让我们使用

[ php]

www.example.com/index.php?id=1

[/ php]

示范网址。


如果你想隐藏''index.php''的名字就把它删掉


ie:

[php]

www.example.com/?id=1

[/ php]

记住保持正斜杠 - / - 在那里。


注意,这只适用于索引页面,因为索引页面是浏览器的默认捕获页面。


[php]

www.example.com/some_directory/index.php?id=1

//成为

www.example.com/some_directory/?id=1

[/ php]

等等等等。


希望这有帮助:)



hi,

我看到了它'很容易创建像index.php这样的导航?id = 1,index.php?id = 2 ...然后你可以隐藏你所在的当前部分。但我需要进一步的步骤(因为我已经看到了)许多),希望它很容易,如何隐藏文件名index.php,以便上述链接变得简单?id = 1,?id = 2 ......如果是这样,那就是很棒:)






有一个很简单的方法可以做到这一点,而无需加载负载和负载你不愿意的目录。这些目录并不是真正隐藏在访客所在的地方,只是简单地移动它。


如果你结账 www.just10northeast.org.uk 您将看到以下大纲在运作。


每个链接都通过JavaScript函数调用onclick方法。这是一个普通的href属性。


该函数有许多参数,第一个是主控制参数,函数用它来确定所需页面的定义位置。第二个是页面定义所需的任何内容,第三个是主页面上div的ID。


然后使用第一个参数确定相关页面,并使用XMLHTTP对象访问它,查询字符串中的secind paratmter返回定义,然后JS函数写入此返回提供ID作为第三个参数的div。


因此,这使用AJAX来解决问题,这意味着URL始终相同,并且网站永远不会重新加载整页但只有部分内容非常迅速。


这里研究的关键术语是AJAX。


如果你想要更具体的帮助然后让我知道,我很乐意为你查看任何代码,甚至帮助我们进行一些开发。


干杯

nathj



hi,

我看到创建像index.php这样的导航很容易吗?id = 1 ,index.php?id = 2 ...然后你可以隐藏你所在的当前部分。但我需要进一步的步骤(如我见过很多),希望它很容易,如何隐藏文件名index.php,以便上面的链接变得简单?id = 1,?id = 2 ...如果是这样,那将是伟大的:)



除了第一个答案,你还可以使用一个名为mod_rewrite的巧妙技巧。它有点先进,但如果你想尝试一下,你可以去http://www.workingwith.me.uk/articles/scripting/mod_rewrite

并确保在httpd中.conf(apache配置文件)AllowOverride设置为All,因此包含AllowOverride的行(前面没有#符号)应该说AllowOverride All。

希望有所帮助。 / BLOCKQUOTE>

hi,
I see that it''s easy to create a navigation like index.php?id=1, index.php?id=2... then you can hide the current part you are in. But I need a further step (as I''ve seen many), hope it''s easy enough, that how can hide the file name index.php so that the above links become simple "?id=1, ?id=2... if so, that''d be great :)

解决方案

Ok lets use
[php]
www.example.com/index.php?id=1
[/php]
for the demonstration url.

If you want to hide the ''index.php'' name just cut it out

i.e:
[php]
www.example.com/?id=1
[/php]
Remeber to keep the forward slash - / - in there.

Note, this will only work for index pages as index pages are the default catch pages for browsers.

[php]
www.example.com/some_directory/index.php?id=1
//becomes
www.example.com/some_directory/?id=1
[/php]
So on and so forth.

Hope this helped :)


hi,
I see that it''s easy to create a navigation like index.php?id=1, index.php?id=2... then you can hide the current part you are in. But I need a further step (as I''ve seen many), hope it''s easy enough, that how can hide the file name index.php so that the above links become simple "?id=1, ?id=2... if so, that''d be great :)

Hi,

There is a realy neat and easy way to do this without loading loads and loads of directories that you don''t wan''t. The directories don''t really hide where the visitor is they simply move it.

If you check out www.just10northeast.org.uk you will see the following outline in operation.

Every link calls a JavaScript function via the onclick method. This is instead of a normal href property.

The function takes a number of parameters, the first is the main control parameter which is used by the function to determine where the required page is defined. The second is anything the page definition requires and the third is the ID of a div on the main page.

Then using the first parameter the relevant page is determined and this is accessed using the XMLHTTP object with the secind paratmter in the query string which returns the definition and the JS function then writes this return to the div whose ID was supplied as the third parameter.

So this uses AJAX to solve the problem and it means that the URL is always the same and the site never reloads a full page but only part of it making it quite swift.

The key term for research here is AJAX.

If you want some more specific help then let me know and I''ll happily look over any code for you and even help with a bit of development.

Cheers
nathj


hi,
I see that it''s easy to create a navigation like index.php?id=1, index.php?id=2... then you can hide the current part you are in. But I need a further step (as I''ve seen many), hope it''s easy enough, that how can hide the file name index.php so that the above links become simple "?id=1, ?id=2... if so, that''d be great :)

Along with the first answer, you can also use a neat trick called mod_rewrite. It''s a little bit advanced, but if you want to try it you can go to http://www.workingwith.me.uk/articles/scripting/mod_rewrite
And make sure that in httpd.conf (apache config file) AllowOverride is set to "All", so the line containing AllowOverride (without a # sign before it) should say "AllowOverride All".
Hope that helped.


这篇关于如何隐藏文件名(.php)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆