Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
.htacces on ccgi to password protect folders
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- .htacces on ccgi to password protect folders
.htacces on ccgi to password protect folders
05-03-2009 2:17 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Is there any simple way to protect folders on the ccgi.username.plus.com server?
I am fairly new to this and my searches of this forum have only found the instructions for the ftp.plus.net server.
I am fairly new to this and my searches of this forum have only found the instructions for the ftp.plus.net server.
Message 1 of 3
(1,917 Views)
2 REPLIES 2
Re: .htacces on ccgi to password protect folders
06-03-2009 10:39 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Hi SideshowJo,
Not a simple way, but...
You can protect static files with .htpasswd on ccgi. However, files with a .php extension get executed before the server even looks for an .htaccess file, so that's trickier, but there is a devious workaround.
First, to protect static files (.html, etc), create an .htpasswd file. Telnet into cshell.plus.net, cd to the folder you want to protect and type
replace "secureuser" with the login name you want to use. You'll be prompted for a password. That creates an .htpsswd file in your folder. Then type
and shell will return the path to that file, which you'll need in the next step. exit.
Then create an .htaccess file for the same directory, including
Replace "/share/storage/path/to/your/folder/" with the path to your folder. (The file needs to be stored as plain txt, uploaded as ASCII and have full read permissions.)
Now for the devious bit. Add the following line to the .htaccess file
Then change your .php extensions to .php4 extensions. Edit your .php4 files to start with a shebang line, e.g.
The .php4 files still need to be executable. Now you have .htpassword protected PHP files.
This may all sound like more trouble than it's worth. An alternative is to put the password and session handling in the PHP code of each file.
Gabe
Not a simple way, but...
You can protect static files with .htpasswd on ccgi. However, files with a .php extension get executed before the server even looks for an .htaccess file, so that's trickier, but there is a devious workaround.
First, to protect static files (.html, etc), create an .htpasswd file. Telnet into cshell.plus.net, cd to the folder you want to protect and type
htpasswd -c .htpasswd secureuser
replace "secureuser" with the login name you want to use. You'll be prompted for a password. That creates an .htpsswd file in your folder. Then type
readlink -f .htpasswd
and shell will return the path to that file, which you'll need in the next step. exit.
Then create an .htaccess file for the same directory, including
AuthUserFile /share/storage/path/to/your/folder/.htpasswd
AuthType Basic
AuthName "protected"
Require valid-user
Replace "/share/storage/path/to/your/folder/" with the path to your folder. (The file needs to be stored as plain txt, uploaded as ASCII and have full read permissions.)
Now for the devious bit. Add the following line to the .htaccess file
AddHandler cgi-script .php4
Then change your .php extensions to .php4 extensions. Edit your .php4 files to start with a shebang line, e.g.
#!/usr/local/bin/php
<?php
phpinfo();
?>
The .php4 files still need to be executable. Now you have .htpassword protected PHP files.
This may all sound like more trouble than it's worth. An alternative is to put the password and session handling in the PHP code of each file.
Gabe
Message 2 of 3
(223 Views)
Re: .htacces on ccgi to password protect folders
07-03-2009 10:46 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Many thanks I shall give this ago.
Message 3 of 3
(223 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- .htacces on ccgi to password protect folders