Current location: Hot Scripts Forums » Other Discussions » Other Topics » Security » protect a directory - sub domain


protect a directory - sub domain

Reply
  #1 (permalink)  
Old 10-04-09, 05:45 AM
samaa's Avatar
samaa samaa is offline
Newbie Coder
 
Join Date: Oct 2007
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Question protect a directory - sub domain

hi guys ,
I need your help...
I want to use .htaccess file to protect a directory to allow specific IP.
actually, I already did that every thing is ok but not perfect!
the directory is protected as the path
but it's not work well as a subdomain !


It's Ok when I entered :
http//:www.exampledomain.com/vb/admin

but it's not Work if I entered as subdomain:
http//:vb.exampledomain.com/admin


I use this .htaccess file

AuthGroupFile /dev/null
AuthName "Admin Area"
AuthType Basic
AuthUserFile /home/****/domains/exampledomain.com/.htpasswd/public_html/vb/admin/.htpasswd
require valid-user

Options +FollowSymLinks
RewriteEngine On

Order deny,allow
Deny from all

# allow my Ip
Allow from ***the Ip***



I search that I can use :
AuthType Digest
and use :
AuthDigestDomain/ http://exampledomain.com/vb/admin/ http://vb.domain.com/admin/

How can I use this ?
and where can I find the .htpasswd file that created after using Password Protection ?


regardsd & waitting for your reply
Reply With Quote
  #2 (permalink)  
Old 10-04-09, 07:42 AM
ruteckycs's Avatar
ruteckycs ruteckycs is offline
Coding Addict
 
Join Date: Jul 2009
Posts: 377
Thanks: 6
Thanked 10 Times in 10 Posts
Have a look at this
http://www.javascriptkit.com/howto/htaccess3.shtml
or
You can use custom code to password protect the index file of you sub domain.
__________________
This post was created with 100% recycled electrons.
Reply With Quote
  #3 (permalink)  
Old 10-04-09, 10:31 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
Move the .htpasswd file out of the public_html tree, so no one can get to it.

When you say it doesn't work for the subdomain, does the page display properly under the subdomain? If not, the subdomain may not be set up properly.
Reply With Quote
  #4 (permalink)  
Old 12-30-09, 12:12 AM
jackkk jackkk is offline
New Member
 
Join Date: Dec 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Firstly, you will need to know the full path to your document root.

Then, in the directory you want to protect with HTTP authentication, create or upload a file named: .htaccess (remember to include the "." before the "htaccess"). Alternatively you can upload a text file called htaccess.txt and rename this once it has been uploaded to .htaccess

The .htaccess file should contain the following 4 lines:

AuthType Basic
AuthName "Some Description"
AuthUserFile /[home dir full path]/httpdocs/.htpasswd
Require valid-user

For example, if your domain was example.com, then the third line would read:

AuthUserFile /usr/local/www/vhosts/example.com/httpdocs/.htpasswd


Good Luck !!!

___________________
<<<removed link>>>

Last edited by wirehopper; 12-30-09 at 05:41 AM. Reason: Removed link
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Password Protect Directory Using PHP eddyvlad Script Requests 2 08-07-07 10:01 AM
New Year 2007 Promotions: We are almost 7 years old! mxhub General Advertisements 1 01-05-07 12:14 PM
Reciprocal link exchange Directory You will be listed in 10+ Other Domain name !!! Club2share.com Traffic Exchange 0 01-28-06 05:40 AM
Best way to protect directory? kvnband PHP 5 07-20-04 08:22 PM
Need Epinions-lite system in PHP & MYSQL wali001 Job Offers & Assistance 4 01-12-04 06:02 AM


All times are GMT -5. The time now is 11:08 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.