1
00:00:00,560 --> 00:00:07,940
Now we can use .htaccess file also for controlling the access that when instead of specifying

2
00:00:07,940 --> 00:00:12,320
authentication directive in httpd.config.

3
00:00:12,530 --> 00:00:21,470
What you can do, you can create .htaccess file in which directory /var/www/html/example1 

4
00:00:21,480 --> 00:00:26,630
directory that is going to control access to our example1.com site.

5
00:00:27,260 --> 00:00:34,440
So in our case, we will go to /var/www/html/example1 directory.

6
00:00:34,460 --> 00:00:41,150
And with cat command we are going to create .htaccess file and we are going to specify these four

7
00:00:41,150 --> 00:00:48,860
lines AuthType Basic, AuthName Restricted Access, AuthUserFile /etc/httpd/webpasswd.

8
00:00:49,130 --> 00:00:56,660
And then we are going to specify Require user anantika and nanu then with ls -a command, we are going

9
00:00:56,660 --> 00:01:05,930
to view our pages that mean Index.html is our default homepage and this is the your access.

10
00:01:06,410 --> 00:01:08,440
Then we can view that also.

11
00:01:08,840 --> 00:01:14,690
But please, just creating this .htaccess file will not do anything.

12
00:01:15,140 --> 00:01:21,120
We have to make one configurations changes in our httpd.config.

13
00:01:22,220 --> 00:01:28,310
What that we have to do to make this file effective, we have to change the value of option, Allow

14
00:01:28,310 --> 00:01:37,700
Override from None to AuthConfig in configuration file httpd.config that mean we will be creating .htaccess

15
00:01:37,700 --> 00:01:38,390
file also.

16
00:01:38,840 --> 00:01:47,120
But to be effective what we need, we will go into our httpd.config file and we will create one

17
00:01:47,120 --> 00:01:52,640
Directory directive regarding /var/www/html/example1.

18
00:01:52,910 --> 00:01:56,000
And we are going to say AllowOverride AuthConfig.

19
00:01:56,330 --> 00:02:04,180
That mean we are saying that please allow the setting of that which are in .ht

20
00:02:04,220 --> 00:02:04,460
access.

21
00:02:04,460 --> 00:02:11,930
file to be implemented and then you just check that configuration.

22
00:02:12,470 --> 00:02:17,720
if It will show syntax is ok, reload http server.

23
00:02:17,930 --> 00:02:27,350
And please remember, we only want to override this directory settings regarding your configuration

24
00:02:27,350 --> 00:02:27,770
setting.

25
00:02:28,040 --> 00:02:31,460
So please do not change this, Directory /.

26
00:02:32,180 --> 00:02:35,660
where by default.

27
00:02:35,660 --> 00:02:39,020
One option is there AllowOverride.

28
00:02:39,020 --> 00:02:41,010
none Require all denied.

29
00:02:41,060 --> 00:02:48,140
That means by default security that /directory otherwise your system will become vulnerable.

30
00:02:48,170 --> 00:02:57,050
So you have to only make changes in which this /var/www/html/example1 because

31
00:02:57,320 --> 00:03:04,400
we want to control the access to our example1.com only.

32
00:03:04,880 --> 00:03:07,940
So let us we are going to see the demo of that also.
