As Dyn.org announced that they would soon stop the free service, I had to move to a new address with this little WordPress-Site.
I ended up with SPDNS and I'm very happy with it. But while moving I had two problems:
- I had to announce the search-engines, that the site is now located at another address. Although the Webmaster Tools from Bing and Google offer the possibility to announce a relocation of your Web-Site, it didn't work in my case, since I use Dynamic IP addresses and therefore only have subdomains.
- After moving I wanted the visitors, who have found a site in the search engines at the old address, to be lead to the correct pages with the new address.
As it turned out, I could solve both pretty easy with Apache.
After searching the internet, I found this code, which has solved the problem perfectly:
RewriteEngine On Options + SymLinksIfOwnerMatch RewriteCond% {HTTP_HOST} ^ oldurl.com RewriteRule (. *) Http://www.newurl.com/ $ 1 [R = 301, L]
Just create a .htaccess-file in the document-root of the site -be aware of the leading dot in front of the filename- and then Apache rewrites all requests on oldurl.com to the appropriate page at the address newurl.com. The addition in square brackets [R = 301, L] tells the search engines that the page has moved permanently. This is evaluated by the search engines when they crawl the pages at the old address, and soon the search results with the old adress will dissappear at Google and Co and visitors will be redirected to the correct pages of the new address.
Add comment