how to hid the fact that webpage is written in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vidyasingh
Forum Newbie
Posts: 1
Joined: Fri May 30, 2008 11:53 am

how to hid the fact that webpage is written in php

Post by vidyasingh »

Hi,
How to hid the fact that webpage is written in php.

Thanks,
Vidya
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: how to hid the fact that webpage is written in php

Post by Christopher »

The easiest is probably to rewrite URL and use a Front Controller. Many PHP frameworks support this. Search for "clean URLs".
(#10850)
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: how to hid the fact that webpage is written in php

Post by califdon »

vidyasingh wrote:Hi,
How to hid the fact that webpage is written in php.

Thanks,
Vidya
Whenever I see a question like this, I have to ask, What problem are you trying to solve?
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Re: how to hid the fact that webpage is written in php

Post by Luke »

I'm curious too... what is the point?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: how to hid the fact that webpage is written in php

Post by Benjamin »

I would think it's a security measure to prevent an attacker from even knowing what language the site is in. There are other reasons too, most of which aren't ethical.
joefazee
Forum Newbie
Posts: 11
Joined: Thu May 29, 2008 7:54 am

Re: how to hid the fact that webpage is written in php

Post by joefazee »

Hi,
How to hid the fact that webpage is written in php.

Thanks,
Vidya
Apache mod_rewrite is the perfect man for that job, but note: I must understand regular expression before you can work with that module.

Google it. ‘rewriting URL with Apache’
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

Re: how to hid the fact that webpage is written in php

Post by panic! »

joefazee wrote:
Hi,
How to hid the fact that webpage is written in php.

Thanks,
Vidya
Apache mod_rewrite is the perfect man for that job, but note: I must understand regular expression before you can work with that module.

Google it. ‘rewriting URL with Apache’

Code: Select all

RewriteEngine On
 
RewriteRule (.*).html $1.php
 
 
SomeoneE1se
Forum Newbie
Posts: 20
Joined: Sat May 31, 2008 2:53 am

Re: how to hid the fact that webpage is written in php

Post by SomeoneE1se »

if you have access to the apache/php configs you could add .1337 to the list of scripts handled by php so index.1337 would work the same as index.php (if you have you dir list also configured correctly)

just look for

AddHandler x-httpd-php5

and add .1337 to the end
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: how to hid the fact that webpage is written in php

Post by VladSun »

On sharing hosting you could use the .htaccess file:

Code: Select all

 
<FilesMatch .exten>
    SetHandler php5
</FilesMatch>
 
Where php5 is the handler defined in php.ini (if it doesn't work try something like php, php4 etc.)
I've been successfully using it with startlogic.com to use PHP5 for processing *.php files, which otherwise would have been processed by PHP4.
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Re: how to hid the fact that webpage is written in php

Post by Ambush Commander »

Also, don't forget to remove the X-Powered-By header. (expose_php = Off)
LSJason
Forum Commoner
Posts: 45
Joined: Mon May 12, 2008 4:43 pm

Re: how to hid the fact that webpage is written in php

Post by LSJason »

astions wrote:I would think it's a security measure to prevent an attacker from even knowing what language the site is in. There are other reasons too, most of which aren't ethical.
Security through obscurity is not security.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: how to hid the fact that webpage is written in php

Post by Benjamin »

LSJason wrote:Security through obscurity is not security.
:offtopic: I never said it was. I meant that it's possible the OP wanted to hide the source language for that reason. It is however one of many security techniques that can be used, and I don't see anything wrong with adding it as an additional layer of security to an existing system. If my memory serves, it's commonly used by financial institutions.
LSJason
Forum Commoner
Posts: 45
Joined: Mon May 12, 2008 4:43 pm

Re: how to hid the fact that webpage is written in php

Post by LSJason »

astions wrote:
LSJason wrote:Security through obscurity is not security.
:offtopic: I never said it was. I meant that it's possible the OP wanted to hide the source language for that reason. It is however one of many security techniques that can be used, and I don't see anything wrong with adding it as an additional layer of security to an existing system. If my memory serves, it's commonly used by financial institutions.
(Even more off topic) I didn't meant to imply that you thought it was the only method...just pointing it out ;)
SomeoneE1se
Forum Newbie
Posts: 20
Joined: Sat May 31, 2008 2:53 am

Re: how to hid the fact that webpage is written in php

Post by SomeoneE1se »

I can think of a very good reason,

he's working for a stubborn client who demands it be created in asp for no other reason then he likes page.asp better then page.php
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: how to hid the fact that webpage is written in php

Post by Benjamin »

Wow that's funny. Using mod_rewrite to parse .asp as .php. He'll be really happy in a few years when the next programmer tells him it's PHP lol.
Post Reply