Is there any security risk in revealing PHP folder names? If yes, is there any way to hide the folder names that exist within my html hyperlinks and in my ajax code?
Is there any security risk in revealing PHP folder names?
To simply say "no" is a poor answer. The answer should be "it depends". For the most part, revealing folder names is a minimal risk, but depending on the information you're trying to obscure/hide, it may be worthwhile to hide folder names. As @nogad points out, you shouldn't just use obscurity to hide away your potential issues, you should focus on securing the actual application.
For example:
/secretz428
, which contains two files. /secretz428/image.php
and /secretz428/admin.php
. By exposing /secretz428/image.php
to your front end users, they may try to dig into this folder, and may happen upon your admin.php
. If there is no security on this script (Or it's prone to hacking), you could open up your site to to an attack. The more you obscure from your users, the harder it is for someone to reverse engineer and find exploits in your application.Is there any way to hide the folder names that exist within my html hyperlinks and in my ajax code?
Sure. One way is to obscure it within a php script. For example:
index.php:
switch ( $_GET['id'] )
{
case '1':
include('secret_folder/mysecretscript.php');
break;
}