How can I go to history.back() when page loads?

javascript, php

Solution

...
<body onload="history.go(-1);">
...

Problem

I have a PHP page that has an error, but if I go back, it works fine. I can't redirect because the page can be accessed from two different places. How can I make a JavaScript that loads automatically when the page loads? Thanks, Sebastian EDIT that wouldn't work. is there a way to get the url of history.go(-2)? thanks, Sebastian

Original source