Hello Magento pals,
Last time we learned How to Display programmatically created custom options in admin order details in Magento 2.
Today, we will learn an interesting topic How to Password Protect Your Magento Store With .htaccess in Magento 2,
Contents
Basically, there is a huge growth in increase on password guess attacks on Magento installations. Sometimes while surfing you might have noticed that you came across any website who is asking for username and password for granting permission to access the website. Mainly, this type of website is containing passwords to protect against the spammers and hackers. To overcome this problem I have came with the best solution in this article.
Step 1: Firstly, with the use FTP or Cpanel to reach to Magento 2 root folder.
Step 2: Then open the .htaccess file and add following code at top.
AuthName "User: admin. Password: admin123" AuthUserFile /patch/to /.htpasswd AuthType Basic require valid-user ErrorDocument 401 "Authorisation Required"
Step 3: Create a file with name of .htpasswd in Magento 2 root. If you want to upload password file somewhere else, you can but make sure you mention the path accordingly in above code then.
Step 4: Use this tool
https://hostingcanada.org/htpasswd-generator/
To setup username and password as given in the below image.
Step 5: Lastly open file .htpasswd now and copy paste the user and encrypted password for example
admin:$apr1$74z9mjal$JKvdv4G7GMpIxc/8m.OPh0
Where, admin is the username and $apr1$74z9mjal$JKvdv4G7GMpIxc/8m.OPh0 is the password respectively.
That’s it for today! By implementing the given above steps you will be able to complete the protection for your website. You can overcome the problem of attacks by spammers and hackers to your website.
Last but not least, if you found the blog interesting, don’t forget to share with your Magento pals. Feel free to Contact Us if you find any difficulty in implementing the above steps.
Happy Magento Learning!
Hello Magento Friends, In today’s blog, I will explain How to Add Tooltip in Checkout…
MongoDB is a popular NoSQL database that offers flexibility and scalability when handling modern web…
In NodeJS, callbacks empower developers to execute asynchronous operations like reading files, handling requests, and…
Hello Magento Friends, In today’s blog, we will learn How to Show SKU in Order…
The "Buy Now" and "Add to Cart" buttons serve as the primary call-to-action (CTA) elements…
Hello Magento Friends, In Magento 2, the checkout process allows customers to choose multiple shipping…