To download support materials, please select your product from the list below. You will automatically be shown all downloads for that product, including extensions, brochures, sales presenters and technotes.

  • 1. Select your section, category and chosen product.
  • 2. Click on the Manual, brochure, sales presenter or technote of your choice.
  • 3. Take careful note of any applicable instructions, especially for extensions.
  • 4. Download the file to your hard drive.
Knowledge Base

Knowledge Base

How to setup .htaccess password in Magento

Categories: Knowledge Base
Date Created: 22 Apr 2016
Last Updated: 3 May 2021

You may want to restrict the development site from search engine or from direct access. Here we will be discussing on how to password protect your development site which makes a use of .htaccess & .htpasswd files. 

Step 1: Use FTP or Cpanel to access the folder containing magento code.

Step 2: Open .htaccess file then insert following code (on top of it).

AuthName "User: admin. Password: admin123"
AuthUserFile /patch/to /.htpasswd
AuthType Basic
require valid-user
ErrorDocument 401 "Authorisation Required"

in which AuthUserFile must exactly call to server's link (to see the full link, you can use ssh, access to the folder containing code then type pwd to command. Another way is to create a testing file and use code <?php  echo $_SERVER['DOCUMENT_ROOT'];?> to see full link. For instance, AuthUserFile /home/user/

Step 3: Create a file .htpasswd at the same level with file .htaccess (not compulsory at same level, however, the link must be correct).

Step 4: Go to the address to setup username and password as you want. After that, copy the outcome.

Step 5: Open file .htpasswd again and paste the copy. Now save it and you can get back to the site to check.

That's it. Only 5 simple steps above, you can totally create password to protect your development site.

Support Enquiry

Support Enquiry

If you have a question or require technical support for a Magespacex hosting or extensions you have purchased, please fill out the form below and a member of our support team will contact you shortly.

  • * Required Fields