How to remove the www from url with rewite rule

setting up basic authentication apache

Two months back, we got the requirement of do basic authentication for testing site server. We given steps and code for setting up basic authentication apache. So Google or any search engine site cannot index the testing sites.

setting up basic authentication apache

We are using Fedora as Operating System and Apache as web server on our testing machine. We hosted more than fifteen test sites on that server.

I successfully created basic authentication on server.

Use following commands:

#su

#ROOT_PASSWORD

#vi /etc/httpd/conf/httpd.conf

in that file you need to insert following lines.

AccessFileName htaccess.acl .htaccess
# htpasswd -c /home/USER/pwd.txt USER(you can define your user of stystem.)
New password: mypassword
Re-type new password: mypassword

That sit. Your username and password is set for popup.

Now you need to only create or update your .htaccess  file. You can create or find .htaccess file in your project folder.

Use or copy and paste following code in that file: (.htaccess file)

AuthUserFile /home/USER/pwd.txt
AuthName "Protected"
AuthType Basic


require valid-user

I following exact method for my server and projects. It is working perfect for me.

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

One thought on “setting up basic authentication apache”

  1. This is a exceptional post, I found your site checking yahoo for a similar topic and arrived to this. I couldnt come across to much additional information and facts on this blog post, so it was good to discover this one. I will certainly end up being back again to look at some other articles that you have another time.

Leave a Reply

Your email address will not be published.