Changed host - indexed on temporary URL

I changed hosts and somehow I got an amount of new pages indexed on the temporary URL used for testing prior to DNS migration.

Anyway to get these unlisted in one go? Robots won’t work as it’s domain specific - so thinking a mod_rewrite?

URL is like:

Real URL is


Managed to get to the following with htaccess, but it is not working or redirecting at all :

RewriteCond %{HTTP_HOST} !^sub\.tempdomain\.com
RewriteRule (.*)$1 [R=301,L]

Can you actually access the old now?

If DNS propogation has taken place there should be no need to rewrite/redirect…

Yes, I can access the temporary URL still. It’s the URL my host gave me when setting up the account to test before DNS prorogation was even started.

I stupidly left the $domain var as the temporary domain when I started propogation so Google picked up some of those links.