Easy answer - you can't.
Longer answer - you cannot totally remove the ability for the user to go back to the previous location, although you can make it harder.
1) You can use the location replace method when changing the location. This replaces the current history location with the new location. However older browsers do not support this method, which is why it is required to test for the images object:
<script language="JavaScript"><!--
if (document.images)
location.replace('http://www.somewhere.com/apage.html');
else
location.href = 'apage.html';
//--></script>
Note: in Opera replace() will work, but only with absolute URL's.
2) You can load the new location into another window, and then close the old window:
In the first page:
<script langauge="JavaScript"><!--
function newWindow(fileName,windowName) { msgWindow=window.open(fileName,windowName); }
//--></script>
<a href="javascript:newWindow('1.html','window1')">Open Window</a>
In the next window:
<script language="JavaScript"><!--
function newWindow(fileName,windowName) { msgWindow=window.open(fileName,windowName); }
function replaceURL(fileName) { newWindow(fileName,'window2'); self.close(); }
//--></script>
<a href="javascript:replaceURL('2.html')">change location</a>
3) You can open a window without a toolbar:
<script language="JavaScript"><!--
msgWindow=window.open('apage.html','windowName','toolbar=no');
//--></script>
However, this does not totally stop the user from being able to go back to the previous page.
4) You can add code to the previous page to force the browser to go forwards again:
<script language="JavaScript"><!--
javascript:window.history.forward(1);
//--></script>