how to hide some html source code on your website?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

how to hide some html source code on your website??

if I published a website and I have created some new Good things, how can I disable people from seeing it and take advantage of my work. any ideas? the website relays on php as a backend.

13th Jan 2020, 2:19 PM
Ahmad Ali
Ahmad Ali - avatar
5 Answers
+ 2
You can do it using htaccess if you use apache server but allowing only your IP if you have a static IP or you will update it each tume if it is dynamic Add the .htaccess file in your root folder usually /something/public_html/ create the error page and your message ErrorDocument 403 /403.html Order Allow,Deny Allow from yourip Or you could use Basic HTTP Authentication Password Protection with htaccess With .htaccess it is very easy to password protect a folder or directory. The method is called htaccess password protection or htaccess authentication, and works by uploading two files called .htaccess and .htpasswd in the directory you want to password protect. The htaccess file should contain the following: AuthType Basic AuthName "Password Protected Area" AuthUserFile /path/to/.htpasswd Require valid-user You only need to change “/path/to/.htpasswd” with the full path to your .htpasswd. Take a look at my article https://www.htaccesstools.com/articles/full-path-to-file-using-php/ on how to find the full path using PHP. Next you need to upload the .htpasswd file which contains the username and password to enter the password protected folder. The .htpasswd file should contain: test:dGRkPurkuWmW2 The above code will allow the user “test” to access the password proteced area with the password “test”. The text “dGRkPurkuWmW2” is a encrypted version of the password. You will need to use a htpasswd generator to create another password. Each line in the .htpasswd file contains a username and password combination, so feel free to add as many combinations as you like. The automatic way – Use the generator You can also just use the htaccess authentication generator to create a htaccess file for password protection. From https://www.htaccesstools.com
15th Jan 2020, 2:39 AM
StoneCoder🇬🇦
StoneCoder🇬🇦 - avatar
+ 2
well to hide it from browser, you can put it in php ( <?php ?> ) and in a comment ( // ). Php does not get parsed by the browser, so it would be hidden from source code and dev tools for most/all browsers. This would mean the html doesn't run. EDIT: Code that the browser displays will always be shown by the source code. The only way is to hide it from the browser itself, which means that it won't display at all on the webpage.
15th Jan 2020, 4:22 AM
Adler Vuong
Adler Vuong - avatar
+ 1
well i also have a website (thesam.co.nz) and if you want an account made then i cant really help you. i struggled with that but i did it. But otherwise nust make a page with your stuff on it but put no link to it or use no src • • Or use a comment ( <!—<img src blah blah >
13th Jan 2020, 9:47 PM
Sam Harford
Sam Harford - avatar
0
javedsheikh
14th Jan 2020, 5:09 PM
Bullet King Javed
Bullet King Javed - avatar
0
Also what us your domain? i would love to visit it!
16th Jan 2020, 9:19 PM
Sam Harford
Sam Harford - avatar