Connect Tech Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Saturday, 22 August 2009

How do I password-protect my website using .htaccess?

Posted on 10:25 by Unknown
Htaccess can be used to password-protect directories on your web sites.
You can do this Password Protection very easily by using below steps
Step 1. Change to the directory that you wish to protect

In the following example we wish to protect a directory called pvt in our htdocs directory.
[root@amit ]# cd /usr/local/apache2/htdocs/
[root@amit.htdocs] # mkdir pvt

Step 2. Create a file named .htaccess
Use your favourite editor to create a file called .htaccess . In the below example we will use vim.
[root@amit.htdocs] # vim .htaccess
Add foloowing lines in .htaccess file
AuthUserFile /usr/local/apache2/conf/.htpasswd #### path of .htpasswd file
AuthName "My Private Password Protect Directory" ### title for the username/password input box.
AuthType Basic
Require valid-user amit #### vaild user name

Step 3. Create the .htpasswd file by adding users
[root@amit.htdocs] # htpasswd -c /usr/local/apache2/conf/.htpasswd amit
New password:
Re-type new password:
Adding password for user amit

This creates a file .htpasswd containing the username amit. Then it will be prompted for a password for amit, which will be stored in the .htpasswd file
So, to create a new users and change the password for existing users, switch to the directory that contain .htpasswd, run this commad # htpasswd -c .htpasswd username

Step 4. Set the permissions on your .htaccess and .htpasswd file
Now use chmod command to chage permission of .htaccess & .htpasswd to make it world-readable

[root@amit.htdocs] # chmod 644 /usr/local/apache2/htdocs/pvt/.htaccess
[root@amit.htdocs] # chmod 644 /usr/local/apache2/conf/.htpasswd

Now you done everything !!!!
Now, anytime you attempt to view your password protected directory (pvt ), any file within it, or recursively any subdirectory of it, you will be prompted for a username and password,
From the desk of Amit Maheshwari
Read More
Posted in | No comments

Wednesday, 19 August 2009

Using_mysqldump_Backup_&_Restore_MySQL_Database

Posted on 04:57 by Unknown
Using mysqldump, you can backup a local database and restore it on a remote database at the same time, using a single command.
An examples on how to use mysqldump to backup and restore


To backup:      # mysqldump -u root -p(root_password) (database_name) > filename.sql

To restore: # mysql -u root -p (root_password) (database_name) <>

from the desk of Amit Maheshwari
Read More
Posted in | No comments
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Popular Posts

  • How to schedule a PHP script in task scheduler
    Quiet often there is a need to execute/run  php  script on some time interval at server side. And that php scripts should run automatically ...
  • HTTP Error 403.19 – Forbidden The configured user for this application pool does not have sufficient privileges to run CGI applications.
    If you get the error “HTTP Error 403.19 – Forbidden The configured user for this application pool does not have sufficient privileges to...
  • Roles and Features showing an error HRESULT: 0x800F0818 in Server Manager of windows server 2008 R2
    When you open Server Manager both Roles and Features display Error and you are unable to add any role or features. When you select the det...
  • Error - "Failed to retrieve data for this request (Microsoft.SqlServer.Management.sdk.sfc)"
    ErrError    - In Microsoft SQL Management Studio 2008, you receive the following error message when you try to expand the Databases:      ...
  • How to configure IIS 7 to redirect non-www domain to www domain?
    One of few legacy leftovers that was never dropped over the years is the common use of www domain prefix. It is not a problem per se for us...
  • Back up all MS SQL databases at once
    This article will discuss how to backup all MS SQL databases with one script. A separate file will be created for each database. Log into ...
  • The media family on device is incorrectly formed. SQL Server cannot process this media family Error: 3241
    When you try to restore a backup of the database you get the following error: The media family on device ” is incorrectly formed. SQL Server...
  • How to check Malware injection in Code
    To check Malware injection in your script/Code you can use a Web based Google Tool called “Webmasters Tools” You can find it here Google We...
  • An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
    If you are facing the following error while accessing the website: Error Summary HTTP Error 500.24 - Internal Server Error An ASP.NET settin...
  • Stopping Unneeded Services In Windows Server 2008
    By  default Windows 2008 starts with a number of services that actually do not need to be running. Many of these services can impact perfo...

Categories

  • booting Process
  • linux
  • redhat

Blog Archive

  • ►  2013 (68)
    • ►  July (1)
    • ►  May (2)
    • ►  April (11)
    • ►  March (54)
  • ►  2012 (44)
    • ►  September (20)
    • ►  August (1)
    • ►  July (4)
    • ►  June (12)
    • ►  May (2)
    • ►  March (4)
    • ►  February (1)
  • ►  2011 (1)
    • ►  February (1)
  • ▼  2009 (9)
    • ►  September (3)
    • ▼  August (2)
      • How do I password-protect my website using .htaccess?
      • Using_mysqldump_Backup_&_Restore_MySQL_Database
    • ►  June (1)
    • ►  May (2)
    • ►  March (1)
Powered by Blogger.

About Me

Unknown
View my complete profile