Hide PHP from user

后端 未结 5 1696
粉色の甜心
粉色の甜心 2021-01-14 04:16

Is there a way to hide the fact that I\'m using PHP from my users? I wanted to do this for two reasons:

  • 1) So the links in the address bar look cleaner (like h
5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-14 04:29

    1) So the links in the address bar look cleaner (like here on stackoverflow)

    mmm. OK

    2) To prevent potential hackers of knowing immediately what to look for

    Security by obscurity. Trust me, that's not going to slow them down much.

    A very valid reason for doing this, however, is so that your website is not tie to a particular development language.

    I see several people have already mentioned mod_rewrite. It's one solution - but it's a very complex tool to master. Also, be very careful about embedding CGI variables in the path of the URL - you can quickly break stuff.

    A simple solution would be to implement every entry-point php script (i.e. anything with is not an include/require file) as 'index.php' and reference it by it's directory.

    Alternatively pick your own file extension and replace the references to .php in the config with your extension.

提交回复
热议问题