how to remove the .php

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
fird01
Forum Newbie
Posts: 19
Joined: Mon Apr 07, 2008 11:04 pm

how to remove the .php

Post by fird01 »

so how do i remove the .php in url..
so my url from this

http://www.url.com/page.php?huh=hah

to

http://www.url.com/page?huh=hah

could it be done in iis..?and how do i do it... ?
User avatar
it2051229
Forum Contributor
Posts: 312
Joined: Tue Dec 25, 2007 8:34 pm

Re: how to remove the .php

Post by it2051229 »

try str_replace() function
User avatar
pcoder
Forum Contributor
Posts: 230
Joined: Fri Nov 03, 2006 5:19 am

Re: how to remove the .php

Post by pcoder »

Go through this site:
http://roshanbh.com.np/2008/03/url-rewr ... ccess.html
I think it would be helpful for you.
marcth
Forum Contributor
Posts: 142
Joined: Mon Aug 25, 2008 8:16 am

Re: how to remove the .php

Post by marcth »

I think this is how the cool kids do it:

Code: Select all

$path = "/home/httpd/html/index.php";
$file = basename($path);         // $file is set to "index.php"
$file = basename($path, ".php"); // $file is set to "index"
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Re: how to remove the .php

Post by Mordred »

++pcoder, the other posters obviously have not understood the OP.
How is that "security" btw?
User avatar
pcoder
Forum Contributor
Posts: 230
Joined: Fri Nov 03, 2006 5:19 am

Re: how to remove the .php

Post by pcoder »

Can anybody tell me up to some extent, how to create the url like this forums.devnetwork.net using HTACCESS.
All the control is from parameter.
I would be very thankful for u.

Thanks
User avatar
pcoder
Forum Contributor
Posts: 230
Joined: Fri Nov 03, 2006 5:19 am

Re: how to remove the .php

Post by pcoder »

Any way i got my solutions.
Thanks
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: how to remove the .php

Post by JAB Creations »

The correct question is: How do I execute PHP without using a file extension?

Additionally it's poor etiquette to get your answer without posting it on a thread when others have attempted to help you. It bothers me greatly when I come across threads on any forum and some guy is like I figured it out but I'm not going to tell any of you. I mean geez... :roll:
User avatar
pcoder
Forum Contributor
Posts: 230
Joined: Fri Nov 03, 2006 5:19 am

Re: how to remove the .php

Post by pcoder »

Actually my requirement was also related to .htaccess. And I posted my requirement here without creating any new topic.
Sorry JAB Creations, my intension was not bad.
Again i want to say sorry.
In the future, i want help from you guys
Thanks
User avatar
allspiritseve
DevNet Resident
Posts: 1174
Joined: Thu Mar 06, 2008 8:23 am
Location: Ann Arbor, MI (USA)

Re: how to remove the .php

Post by allspiritseve »

pcoder wrote:Actually my requirement was also related to .htaccess. And I posted my requirement here without creating any new topic.
Sorry JAB Creations, my intension was not bad.
Again i want to say sorry.
In the future, i want help from you guys
Thanks
I think he just meant that, instead of this:
pcoder wrote:Any way i got my solutions.
Thanks
He wanted you to post the solution that you found, so that others can learn from this post in the future when they run across the same problems.
allicient
Forum Newbie
Posts: 9
Joined: Fri Sep 19, 2008 7:11 pm

Re: how to remove the .php

Post by allicient »

Its your webserver (most likely Apache) that determines this. I can't remember off-hand but its something like "AddType". Anyway, if you get your httpd.conf setup right, you can just rename all your .php files.

Not that I can see *why* you'd ever want to do this.
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Re: how to remove the .php

Post by Maugrim_The_Reaper »

Did the OP simply want to know about creating pretty URLs using mod_rewrite in Apache so a non-php extensions URL maps to a real .php file on the server (but the end user won't see this)?
Post Reply