Forum Moderators: phranque
My own site (www.mydomain.com) should be showing in search engines, and it does somewhat. However, the temporary url given by my virtual host company (username.hostsdomain.com) has replaced my domain in the SERPs. The host's subdomain names were publically exposed during server maintenance, and now the spiders won't let go of them.
Is it possible to rewrite these requests so the pages requested under the hosts url (username.hostsdomain.com) will go out under only my own domain name (www.mydomain.com)?
I only have access to my own site directory, not to the hosts site.
Thanks for any ideas or links to other threads.
If so, then this is a simple domain redirection problem.
If not, then the only solution is to use canonical URLs in all links on your pages, so that every link on your site includes the proper domain name, instead of using page-relative or server-relative links.
Jim
So, if both the temporary domain (actually a subdomain of your host's domain) and your 'real' domain both resolve to your filespace, then you can use mod_rewrite to check the hostname requested by the client, and redirect to the proper domain. This really doesn't mean anything to browsers, but search engines, upon seeing the redirect, should update their URLs to use the correct domain.
As an example:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^username\.hostdomain\.com
RewriteRule (.*) http://www.yourrealdomain.com/$1 [R=301,L]
For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim