我如何得到Www.Xyz.Com/Page Insted of Www.Xyz.Com/Page.Php [英] How Do I Get Www.Xyz.Com/Page Insted Of Www.Xyz.Com/Page.Php

查看:80
本文介绍了我如何得到Www.Xyz.Com/Page Insted of Www.Xyz.Com/Page.Php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友。



i我正在学习php我看过一些网站,其中我得到的网址如

eg



www.website.com/page



通常当我在localhost上运行时我得到的网址如



www.website.com/page.php



所以在其他网站上我看不到的是什么。 php扩展。



谢谢

Hello Friends.

i am learning php i have seen some websites in which i am getting URL like
e.g.

www.website.com/page

normally when i run on localhost i get URL like

www.website.com/page.php

so what is there in other website in which i cant see that .php extension.

Thank You

推荐答案

如果你把一个名为的文件index.php 在与 www.website.com/page 对应的文件夹中,当您要求<$ c时,网络服务器将获取该文件$ c> www.website.com/page - 如果您要求 www.website.com/page/index.php,它也会获取相同的文件



这是'廉价n讨厌'的方法。



你也可以使用所谓的urlrewriting。



这是微软的页面,如果你使用的话g IIS:

http://www.iis.net/downloads/microsoft/url -rewrite [ ^ ]



如果您使用的是Apache而不是IIS,那么这是Apache的页面:

http://httpd.apache.org/docs/2.0/misc/rewriteguide.html [ ^ ]
If you put a file called index.php inside the folder that corresponds to www.website.com/page then the webserver will grab that file when you ask for www.website.com/page - though it will also fetch the very same file if you ask for www.website.com/page/index.php.

That's the 'cheap n nasty' approach.

You can also use what's known as urlrewriting.

Here's Microsoft's page if you're using IIS:
http://www.iis.net/downloads/microsoft/url-rewrite[^]

And here's Apache's page if you're using it instead of IIS:
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html[^]


这篇关于我如何得到Www.Xyz.Com/Page Insted of Www.Xyz.Com/Page.Php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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