-1

As I said in the title, how to hide the source view of a page with htaccess ? Like that:

(fake code) IF [URL START WITH "view-soure"] - DONT_SHOW_CODE_PLZ
user_93485
  • 19
  • 2

1 Answers1

2

You can't.

The view-source: URL prefix is handled internally by the browser.

The server doesn't get to see it, so server-side code can't trigger based on it.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • So how can I protect my code from thieves? – user_93485 Aug 23 '21 at 21:52
  • 1
    Copyright law. You'll need a lawyer. (Odds are the code isn't worth protecting anyway). – Quentin Aug 23 '21 at 21:53
  • _"So how can I protect my code from thieves?"_ - that is a question countless people have asked before you already. And the answer is, for the most part - **you can't**. The web is build on openness, you can not really "hide" client-side code, at most you can obfuscate it. (But then again, most people asking this kind of question are on such a beginner level, that their code usually isn't worth protecting from "stealing" in the first place.) – CBroe Aug 24 '21 at 12:52