Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 10-Mar-15 1:19am
v2

1 solution

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[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 10-Mar-15 7:54am    
5ed.
—SA
enhzflep 10-Mar-15 8:04am    
Thanks Sergey. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900