Can I protect the source code of my website?
Partly. Visitors can always see the HTML, CSS and JavaScript that your website sends to their browser, but your PHP code stays on the server and can be protected further with encoding.
What visitors can see
Section titled “What visitors can see”Anything that runs in the browser can be viewed by anyone, for example by right-clicking and choosing View Page Source or pressing Ctrl + U. This includes:
- HTML
- CSS
- JavaScript
You can make JavaScript harder to read by minifying or obfuscating it, but you can’t hide it completely.
What visitors can’t see
Section titled “What visitors can’t see”PHP code runs on the server. Visitors only see the HTML it produces, never the PHP itself. So your PHP code is already private, as long as your hosting account stays secure.
Protecting PHP code with ionCube
Section titled “Protecting PHP code with ionCube”If you share or sell PHP code, or want to stop others with access to your files from reading it, you can encode it with ionCube. The ionCube Loader is available on Ruachost hosting, so encoded files run normally. See Using the ionCube PHP loader.
Keep your files secure
Section titled “Keep your files secure”- Use strong, unique passwords for cPanel, FTP and your website’s admin area.
- Only give file access to people you trust.
See Creating a strong password.
Related articles
Section titled “Related articles”Was this page helpful?
Thanks for your feedback.