I have a website.It has got two pages.page1 and page2.

Page1 is the home page.In page1 there is a button.
If the user clicks on the button page2 will get opened.

when the user types the url of page2 on the address bar page2 is getting opened.

I dont want the user to directly go to page2.

whenever user types address of page2 ,he should be redirected to the home page.

Only on clicking the button in page1,the user should go to page2.

format of url is like this

http://myshec774733/myportal/page1 (this is the homepage)

if the user types http://myshec774733/myportal/page2 on the address bar he should be directed to page1.

Please help

As your first page is called 'Page1', it is a bit predictibal that the next page will be called 'Page2'

You could change the name of 'Page2' to somthing like 'PG002', therefor it will be more dificult for the user to acsess the page by guessing. There is not many ways of blocking the user from guesing using HTML though, you will be better off using another dynamic form of coding for this to work proply.