cancel
Showing results for 
Search instead for 
Did you mean: 

how do I set up a secure page on my website?

samgregkt
Grafter
Posts: 81
Registered: ‎26-06-2012

how do I set up a secure page on my website?

I have a small website consisting of twelve pages with hover buttons linking each page. I'd like to add a new page for members only, being password protected. How can I do this. As I'm still a newbie please keep it simple & assume that I know nothing.
Best regards, Mick
60 REPLIES 60
Kelly
Hero
Posts: 5,497
Thanks: 380
Fixes: 9
Registered: ‎04-04-2007

Re: how do I set up a secure page on my website?

You might find this useful! 
http://www.freewebmasterhelp.com/tutorials/htaccess/
Kelly Dorset
Ex-Broadband Service Manager
spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: how do I set up a secure page on my website?

Reordering and slightly adapting previous posts covering this subject for clarity ...
Quote from: jelv
...  just put the pages you want to be protected in to a sub-directory which you would password protect.

and ...
Quote from: spraxyt
(The procedure for password protecting that folder) is described in the Community Support Library article How to password protect your website. The files you need to upload will become "hidden" when they are renamed so their first character is a dot. To make FileZilla show these you need to go to its Server menu and select (tick) the bottom item that says "Force showing hidden files". You can leave that permanently selected.

David
samgregkt
Grafter
Posts: 81
Registered: ‎26-06-2012

Re: how do I set up a secure page on my website?

Hi Spraxyt, everything was going fine until I got to stage 3:   
Connect to your webspace and go to the folder you want to password protect, and upload both files.

Use your FTP program to CHMOD htaccess.txt to 744 (File Owner: read, write & execute, group & public: read only).
I'm using Filezilla so where do I find the CHMOD etc. & what is (File Owner: etc).
I've been onto Filezilla & used server/force showing hidden files & then uploaded the two files but I'm a little confused. What do I do next?
spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: how do I set up a secure page on my website?

chmod is the Linux shell command for setting file and directory access permissions and many users seem to recognise that term for describing what is required. The appropriate column in FileZilla is headed Permissions which on Homepages contains some letters and the octal number referred to in the article. One can change the permissions by right-clicking on the file, selecting File permissions on the menu and replacing the number in the pop-up dialogue or selecting appropriate check boxes, and clicking OK.
However the default value for uploaded files will be 644 and that should work OK, even though the article says 744 is needed. I suggest leaving the file permissions unchanged at 644. If you've uploaded the file you want to restrict to the new folder browse to it and you should be asked to provide the username and password you set for that directory. The URL you need will be like http://... website .../newfolder/newfile.htm.
David
samgregkt
Grafter
Posts: 81
Registered: ‎26-06-2012

Re: how do I set up a secure page on my website?

Thanks Spraxyt, I found everything you've mentioned late last night. I've yet to try it in my browser, I'll let you know if it works, thanks again for your help. Best regards, Mick.
samgregkt
Grafter
Posts: 81
Registered: ‎26-06-2012

Re: how do I set up a secure page on my website?

Thanks Spraxyt. I thought that I'd followed the instructions on the support page to the letter about .htaccess & .htpasswd but when when I browse as you've suggested  (The URL you need will be like http://... website .../newfolder/newfile.htm.) I get an HTTP404 message, if I browse, http://... website .../newfile.htm.I can view the page without have to use a user name or password. When I use FileZilla should I have dragged the file/page from within the folder that I wanted to protect from the local site to the remote site or just the folder? If it should have been just the folder is that why i can still view the page in the browser? 
On the support page it reads: Step 4,  The final step is to rename the two files as follows - note the leading full stop:
•Rename htaccess.txt to .htaccess
•Rename htpasswd.txt to .htpasswd
Should I have renamed them on both the local site as well as the remote site, if only one, which one? Should I have dropped the .txt extention?
Why on Filezilla is the file size different on the local site to that on the remote site even after a transfer has been successful?
Many thanks thanks for your help, I'm trying to learn as fast as I can.
Best regards, Mick
spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: how do I set up a secure page on my website?

The original 404 error when trying to browse to the restricted file newfile.htm occurs because it has been uploaded to the root of your webspace and not into the protected folder (newfolder). Only files you upload into newfolder will be protected.
When you want to upload files to a particular folder, in my opinion the easiest approach is to click (once) on that folder name in FileZilla's top right-hand (remote site) pane; that should open the folder so its contents (if any) show in the bottom right-hand pane. The "remote site" box will say /htdocs/newfolder.
If you now drag files from the left-hand pane (your own computer) to the right-hand one (remote site) they will be uploaded into the required location - newfolder.
It is possible to move files between folders when renaming them but for now I think the simplest solution is to delete the file uploaded to your web root /htdocs, and upload it again into newfolder.
The control files htaccess.txt and htpasswd.txt need to retain those names on your own computer - Windows does not handle filenames that start with a dot well. They should be renamed to .htaccess and .htpasswd (add the dot and remove the ,txt extensions) only on the web site after being uploaded.
The filesizes on the website differ from those on your computer because when uploading recognised text files FileZilla changes their line endings from Windows format CRLF (two characters, carriage return - line feed) to Linux format LF (just line feed). So the remote file should be smaller by 1 byte for each line, except possibly for the last line which might not have a line ending. The reverse happens when files are downloaded.
I assume newfile.htm is not really called index.htm and you don't have an index.htm in newfolder. Have you checked what you get if you browse to http:// ... website ... /newfolder without specifying a file name? Lips_are_sealed
David
samgregkt
Grafter
Posts: 81
Registered: ‎26-06-2012

Re: how do I set up a secure page on my website?

Hi Spraxyt, I don't normally give up on a project & I'm not easily beaten....but! I really can't crack this one. I've installed/copied/deleted/renamed/created/deleted & recreated but I'm really in trouble. Confused & totally wasted. Question 1: when I create the .htaccess file, is the user name ( AuthUserFile /share/isp/plusnet/www/uu/username/htdocs/path/.htpasswd) the name of my website or my plusnet user name. I've tried both but I just want to be reassured that it's my www. websitename, & do I have to include all of the path in htdocs or just the main htdocs.
Question 2: I only want to protect a page within my website & if I save both the access & passwd files to the folder that the page is in, I then can't access the site, a network 500 error appears. I've created a newfolder & saved both of the access/passwd files plus the members page, but when I try to find them on my browser I only get the 404 failure message. 
I really hate to beat beaten & as 'your student', I'd love to say that I've got it up & running. I've now deleted my members page as I'd really like to start again. Can you lay the whole procedure as talking to an idiot, I can follow basic instruction, just don't go too deep. I wish you lived in Kent!
Best regards, Mick                 
Pettitto
Plusnet Alumni (retired)
Plusnet Alumni (retired)
Posts: 6,346
Fixes: 5
Registered: ‎26-11-2011

Re: how do I set up a secure page on my website?

Hi samgregkt,
Who is hosting your website? Does the provider you are using support PHP?
If it does support PHP, I've some ideas about how you can implement this pretty easily Smiley
spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: how do I set up a secure page on my website?

The website is on Homepages which doesn't allow customer PHP.
Getting a server 500 error suggests there is something in the .htaccess file that the Apache server does not like. What editor are you using to create the original htaccess.txt file? If you are using Frontpage to create that (and the accompanying htpasswd.txt) there is potential for big trouble.
David
samgregkt
Grafter
Posts: 81
Registered: ‎26-06-2012

Re: how do I set up a secure page on my website?

Hi Chris & Spraxyt. Chris, my host is Plusnet & Spraxyt says that Plusnet doesn't support PHP .......I'm even more confused now as everything that I've done has been with Plusnet. Spraxyt the editor that I used was note book, as suggested in the Community Support Library article 'How to password protect your website'. Do you not think that the server 500 error might suggest that the problem is with me & not with Apache (I thought that it was Filezilla). My website was built using FrontPage 2000 & everything else is working ok. To me this is only another hyperlink & all of my other hyperlinks are working. I want to password protect only one page within my site by using either a hover button or a hyperlink. I think that I just need a little more help.
Chris, if you think that you know of a way to implement this I'll give it a shot. Spraxyt, I'd obviously like your comments on the advice given. Come on guys, you're the experts, I'm only the apprentice. 
Best regards, Mick.     
spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: how do I set up a secure page on my website?

I think the best way forward with this is to leave trying to password protect a folder for the moment, let's create a folder and put a "hello world" page into it. If this works OK we can move on.
Firstly, please create a folder on your website literally called newdir (I assume that name doesn't clash with anything there already).
You can do that in FileZilla by FTPing to your website, ( /  will show as Remote site ),
click the + just below Remote site
right click the htdocs icon and select Create directory
type newdir in place of the highlighted New directory and click OK.
Now click the + against htdocs, and click newdir to display its contents in the lower pane (Empty directory listing at the moment)
Then create the file helloworld.htm in Notepad on your own computer containing
[code=helloworld.htm]
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title>Simple Hello World Page</title>
</head>
<body>
  <h1>Hello World!</h1>
</body>
</html>[/code]
Save the file as helloworld.htm and use FileZilla to upload it into folder newdir on your websie. I am expecting the file size of helloworld.htm to be 195 bytes on your own computer, and 187 bytes on your website. If your sizes are different the values should differ by 8.
If you now browse to http:// ... website ... /newdir/helloworld.htm does Hello World! display?
David
samgregkt
Grafter
Posts: 81
Registered: ‎26-06-2012

Re: how do I set up a secure page on my website?

Hi sraxyt, thanks for that. I'll try it over the next few days. Quite busy at the moment & I want to read through everything first. Talk to you soon.
Best regards.
samgregkt
Grafter
Posts: 81
Registered: ‎26-06-2012

Re: how do I set up a secure page on my website?

Hi Spraxyt, Bingo! (I told you that I could follow simple instruction)
Hello World! is displayed. Now I'm excited.
question: why in FileZilla is there a question mark symbol in the htdocs folder below the main folder? (just an observation)
best regards, Mick.