473,606 Members | 2,110 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hiding PHP extension

I'm supposed to hide the php extension in a file (like Yahoo! or
Google). For example, http://foo.com/foo instead of
http://foo.com/foo.php. I have read various articles including
<http://in2.php.net/security.hiding > . Certainly mod_rewrite is not
the right option. In Apache, "file.php" & "file" are treated as same
(content negotiation??) and like to know, how reliable it is? Is there
any other options to do the same? TIA

--
http://www.sendmetoindia.com - Send Me to India!
Email: rrjanbiah-at-Y!com
Jul 17 '05 #1
21 6482
R. Rajesh Jeba Anbiah <ng**********@r ediffmail.com> wrote or quoted:
I'm supposed to hide the php extension in a file
(like Yahoo! or Google). For example, http://foo.com/foo
instead of http://foo.com/foo.php.


Use http://foo.com/foo/ instead.
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #2
On Fri, 02 Apr 2004 10:21:15 +0000, Tim Tyler wrote:
R. Rajesh Jeba Anbiah <ng**********@r ediffmail.com> wrote or quoted:
I'm supposed to hide the php extension in a file
(like Yahoo! or Google). For example, http://foo.com/foo
instead of http://foo.com/foo.php.


Use http://foo.com/foo/ instead.

This will fail.. as it will look for a directory. The OP has it right..
and I don't forsee any issues with the way they have it.. although I maybe
missing some hidden issues.

Regards,

Ian

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/

Jul 17 '05 #3
R. Rajesh Jeba Anbiah wrote:
For example, http://foo.com/foo instead of
http://foo.com/foo.php. Is there
any other options to do the same? TIA


I do:

..htaccess in DocumentRoot

ErrorDocument 404 /notfound.php
and /notfound.php

<?php
// validate $_SERVER['REQUEST_URI']
// and either {
// show some specific page/data
// } or {
// show error message
// }
?>

So if you go to http://example.com/foo and /foo does not exist,
/notfound.php will take control and can include/require or redirect to
/foo.php

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #4
Pedro Graca wrote:
Is there
any other options to do the same? TIA


I do:

.htaccess in DocumentRoot

ErrorDocument 404 /notfound.php
and /notfound.php

<?php
// validate $_SERVER['REQUEST_URI']
// and either {
// show some specific page/data
// } or {
// show error message
// }
?>

So if you go to http://example.com/foo and /foo does not exist,
/notfound.php will take control and can include/require or redirect to
/foo.php


Wouldn't this just return a 404 header and the content (thereby telling
any search engines to remove it from their list as you wouldn't normally
have valid content in a 404 page).

Cheers,
Andy
Jul 17 '05 #5
Andy Jeffries wrote:
Pedro Graca wrote:
I do:

.htaccess in DocumentRoot

ErrorDocument 404 /notfound.php
and /notfound.php

<?php
// validate $_SERVER['REQUEST_URI']
// and either {
// show some specific page/data
// } or {
// show error message
// }
?>
Wouldn't this just return a 404 header and the content (thereby telling
any search engines to remove it from their list as you wouldn't normally
have valid content in a 404 page).


Yes, it would ... unless you also send a

header('HTTP/1.0 200 OK');

which overrides Apache's behaviour.

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #6
On 1 Apr 2004 22:08:14 -0800, ng**********@re diffmail.com (R. Rajesh Jeba
Anbiah) wrote:
In Apache, "file.php" & "file" are treated as same
(content negotiation??) and like to know, how reliable it is?


I've been using this for a while and have had no problem with it. Just
remember to set Options MultiViews.

--
Andy Hassall <an**@andyh.co. uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #7
put this in an .htaccess file

DefaultType application/x-httpd-php

This will make all unknow filetype to be considered as php file.

Savut

"R. Rajesh Jeba Anbiah" <ng**********@r ediffmail.com> wrote in message
news:ab******** *************** ***@posting.goo gle.com...
I'm supposed to hide the php extension in a file (like Yahoo! or
Google). For example, http://foo.com/foo instead of
http://foo.com/foo.php. I have read various articles including
<http://in2.php.net/security.hiding > . Certainly mod_rewrite is not
the right option. In Apache, "file.php" & "file" are treated as same
(content negotiation??) and like to know, how reliable it is? Is there
any other options to do the same? TIA

--
http://www.sendmetoindia.com - Send Me to India!
Email: rrjanbiah-at-Y!com


Jul 17 '05 #8
On Fri, 2 Apr 2004 14:16:01 -0500, "Savut" <we***@hotmail. com> wrote:
put this in an .htaccess file

DefaultType application/x-httpd-php

This will make all unknow filetype to be considered as php file.


This really isn't a good idea.

--
Andy Hassall <an**@andyh.co. uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #9
But this is what you HAVE TO DO to do it, you just have tu put your files
and the .htaccess file in a special folder, and this rule apply only to the
folder, just like the cgi-bin works. That's what major compagny do, and it
work more normaly than the others solutions as the rule is designed for to
do this job.

Savut

"Andy Hassall" <an**@andyh.co. uk> wrote in message
news:i3******** *************** *********@4ax.c om...
On Fri, 2 Apr 2004 14:16:01 -0500, "Savut" <we***@hotmail. com> wrote:
put this in an .htaccess file

DefaultType application/x-httpd-php

This will make all unknow filetype to be considered as php file.


This really isn't a good idea.

--
Andy Hassall <an**@andyh.co. uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space


Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2535
by: R. Rajesh Jeba Anbiah | last post by:
Sometimes ago I started a thread <http://groups.google.com/groups?threadm=abc4d8b8.0404012208.76ebdba7%40posting.google.com> <Previous post> I'm supposed to hide the php extension in a file (like Yahoo! or Google). For example, http://foo.com/foo instead of http://foo.com/foo.php. I have read various articles including <http://in2.php.net/security.hiding> . Certainly mod_rewrite is not the right option. In Apache, "file.php" & "file"...
8
3117
by: Pjotr Wedersteers | last post by:
I am new to J(ava)Script, use PHP a lot and consider moving some stuff for a project over to the client side. Problem is part of the PHP code is copyrighted and the author would not be happy to see his work made available to the world. Guess he is entitled to that opinion. Is it possible to hide javascript and/or html data from the user or is the only way to make it hard to get by obscuring it through removing indentation, variable...
5
1655
by: Arnaud Legrand | last post by:
Hello, I have a question about portability and I have not found the answer in the FAQ. I have different modules to build. All of them have the same private part and a common public part (though the implementation in all cases may be different). Note that I already have implemented a similar idea and that it works pretty well with my gcc but I don't know whether it is portable or not (especially with those damn padding bytes... ;). As a...
7
5160
by: Dennis | last post by:
I have a class named myclass that inheirits from "baseclass". There is a property of "baseclass" that I don't want exposed in the IDE. The MSDN documentation says" "A derived type can hide an inherited member by defining a new member with the same signature. This might be done to make a previously public member private or to define new behavior for an inherited method that is marked as final. " However, this does not hide the...
19
3825
by: Badr.ALmuzini | last post by:
hi,there how can i make php file extension hidden in the URL somthing like this (http://mail.google.com/mail/?view) Regard....
13
4498
by: Matt | last post by:
Does anyone know how to hide the ASPX extension of web pages in ASP.Net 2.0? Thanks, Matt
6
1779
by: 3338761 | last post by:
I'm a beginner programmer so bear with me if this seems very simple... I have a subform which I don't want to have displayed until the user has entered first name, last name, extension, and chose a dept. from a combobox. The If condition I tried for the first name was: If Me.Employee_First_Name.Value = Null Then Me.Report_Sub.Visible = False Else Me.Report_Sub.Visible = True
2
1794
by: codexxx | last post by:
Hi,all I wanted to make a system so that in the browser php extension cant be seen. Though I have been able to make it by editing the .htaccess file but I want it such a way that if anyone type the php as extension then it would take him to an error page. Please help me by giving a .htaccess file where that code is written or give me any useful link. Its very urgent so if you can help quickly then it would help me gain some...
8
1458
by: Frank Rizzo | last post by:
How come VS2008 does not show built-in extension methods for the string class? Like ToList() method, for instance.
0
7939
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8432
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8428
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8078
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8299
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6753
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5962
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5456
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2442
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.