I worked on a website for which I had a “development URL” that looked something like this:
http://www.example.com.php5-9.dfw1-2.example.com/
Now, several weeks after the website launch, there is at least one page of content indexed on Google with that URL.
Question: How do I redirect all requests from that test URL to reroute to the actual domain?
So, for instance, I would want:
http://www.example.com.php5-9.dfw1-2.example.com/page-name
To go to:
http://www.example.com/page-name
The website is powered by WordPress and hosted on a PHP server. I’ve experimented with .htaccess without much success.
If http://www.example.com is ought to be the only valid host name on your server, you can use this rule to force this host name:
Otherwise try this rule to redirect just this specific host name:
You might additionally check the request method in REQUEST_METHOD since this rule will match any method (GET as well as POST).