1
00:00:00,180 --> 00:00:06,600
Another very important option is the Redirect option, when we are going to use the Redirect option, it

2
00:00:06,600 --> 00:00:13,320
is used to redirect some url/page to another one. To understand how this work.

3
00:00:13,660 --> 00:00:19,090
we are going to create one additional page, new.html in our /var/www

4
00:00:19,170 --> 00:00:27,440
/html/example1 directory and changed the VirtualHost setting for 172.24.0.1.

5
00:00:27,780 --> 00:00:33,000
First, what we are going to do, we will go into /var/www/html/example1.

6
00:00:33,000 --> 00:00:35,100
directory, we will list.

7
00:00:35,460 --> 00:00:42,030
We will find that the index.html file is there. now, we will create one another, new.html

8
00:00:42,030 --> 00:00:42,420
file.

9
00:00:42,540 --> 00:00:44,370
We will name the file as new.html.

10
00:00:44,790 --> 00:00:47,970
You can name, give any name here.

11
00:00:47,970 --> 00:00:51,990
We are giving the name new.html and we will put some data here.

12
00:00:52,470 --> 00:01:00,030
And in our case, we are putting the data "redirect to new page" then with a ls -l we are going

13
00:01:00,030 --> 00:01:03,240
to list now we have got 2 files index.html.

14
00:01:03,240 --> 00:01:05,180
and new.html

15
00:01:05,610 --> 00:01:14,280
Now we want that when some person is going to access it by using 172.24.0.1, then what

16
00:01:14,280 --> 00:01:19,440
should display, instead of this, it should redirect to new.html.

17
00:01:19,980 --> 00:01:28,470
So what we have to do, we will go to our httpd.config file and on VirtualHost settings we are going

18
00:01:28,470 --> 00:01:31,920
to make changes that mean for first section.

19
00:01:31,920 --> 00:01:33,270
We are going to make the changes.

20
00:01:33,780 --> 00:01:41,280
This parameter is same 172.24.0.1 ServerName is there DocumentRoot is there, this additional we have to

21
00:01:41,580 --> 00:01:42,060
write.

22
00:01:42,480 --> 00:01:46,920
We are saying that Redirect permanent that means permanent.

23
00:01:46,920 --> 00:01:48,600
This resource has moved.

24
00:01:49,870 --> 00:01:53,590
Which file, if somebody is going to access /index.html 

25
00:01:55,210 --> 00:01:56,810
where should it redirect 

26
00:01:57,040 --> 00:01:59,790
http://172.24.0.1/new.html

27
00:01:59,800 --> 00:02:09,070
that mean because when we are going to test by using elinks

28
00:02:09,100 --> 00:02:14,200
dump 172.24.0.1, the request will come to the Web server.

29
00:02:14,200 --> 00:02:20,660
Web server will read this stanga and by default, it has to display the index.html.

30
00:02:20,770 --> 00:02:27,960
But when it is going to read this directory, what will happen instead of displaying index.html 

31
00:02:28,000 --> 00:02:32,140
content it is going to display the contents of new.html.

32
00:02:32,590 --> 00:02:41,830
We will test the syntax by using the service http configtest and then we will reload our httpd

33
00:02:42,040 --> 00:02:42,720
server.
