There are two options.
<link rel="canonical" href="resultingurl">
<meta name="robots" content="noindex">
At least this way, you're pointing out to google that the first page is the duplicate of the new page and you prefer the new page to be indexed. Also, you're specifically telling all search engines not to index the first page. Therefore, no chance of duplication issues.
You can easily use PHP to do this by creating index.php with the following contents:
header("HTTP/1.1 301 Moved Permanently",true);
Save the file in document root to make the main domain redirect to the new one.
Replace example.com in the code with the new url the first url is supposed to redirect to.
Whatever you do, just make sure the duplicate pages (copies of the same pages with an HTTP 200 status code) are no-indexed.