Saturday, December 1, 2012

.htaccess correct Page to Page 301 Redirect

Hi guys,

This will be a short post on how to permanently redirect your old site to a new site using .htaccess.

If you want to move your site to a new domain the proper .htaccess redirect should look something like this:

For the index page use the following redirect:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.OLDSITE\.com$ [OR]
RewriteCond %{HTTP_HOST} ^OLDSITE\.com$
RewriteRule ^/?$ "http\:\/\/www\.NEWSITE\.com" [R=301,L]
</IfModule>

What this redirect will do is only redirect the old index page with the new index page, so when someone types www.oldsite.com it will open www.newsite.com.

If you want to redirect the old site to a sub directory on the new site you should use the following .htaccess redirect:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.OLDSITE\.com$ [OR]
RewriteCond %{HTTP_HOST} ^OLDSITE\.com$
RewriteRule ^/?$ "http\:\/\/www\.NEWSITE\.com\/OLDSITE\.html" [R=301,L]
</IfModule>

Now you want to redirect all other pages right? Here is how it's done:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^OLDPAGE\.html$ http://www.NEWSITE.com/OLDPAGE.html [R=301]
</IfModule>

At the end it should look something like this:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.OLDSITE\.com$ [OR]
RewriteCond %{HTTP_HOST} ^OLDSITE\.com$
RewriteRule ^/?$ "http\:\/\/www\.NEWSITE\.com" [R=301,L]
RewriteRule ^OLDPAGE1\.html$ http://www.NEWSITE.com/OLDPAGE1.html [R=301]
RewriteRule ^OLDPAGE2\.html$ http://www.NEWSITE.com/OLDPAGE2.html [R=301]
RewriteRule ^OLDPAGE3\.html$ http://www.NEWSITE.com/OLDPAGE3.html [R=301]
RewriteRule ^OLDPAGE4\.html$ http://www.NEWSITE.com/OLDPAGE3.html [R=301]
</IfModule>

Do this for all pages and keep the content intact or very close to the old site.
Keep the old files until you notice that all pages are indexed correctly and all visitors are redirected correctly.


Merging multiple websites into one

Hello guys,

First of all apologies for my English, will try to keep it as clean and readable as possible.

Starting this blog in hope to find solutions to some of the problems I've encountered on my "webmaster" trip, and to give a solution to some problems about SEO and running a website in general.

Starting from the last encountered problem which is Merging multiple websites into one.

Was running couple of websites on a similar, but not the same topic. After the last EMD, Panda, Penguin and other scary wild Google animals  my websites suffered severely. Some of them were hammered by EMD, others for link building, and some were just not lucky enough. Those sites were two years old, well established PR4  - PR3 and visible on every search engine starting from #1 in Google all the way down to the #10 spot for many keywords.

After the latest "Black & White" Google update I was banging my head on how to solve the problem and get back on my feet, again. So I came up with an idea to merge all sites into one big brand looking site. I am not talking about redirecting all sites to the homepage of the new one, but redirecting every single page to new appropriate location. So, some of the sites became categories, others became sub categories along with their content.
For an example, the old URL was something like this: http://www.oldsite.com and the new URL was http://www.newsite.com/oldsite.html.
The categories from the old site were http://www.oldsite.com/oldcategory.html and that became http://www.newsite.com/oldsite/oldcategory.html.
The files were http://www.oldsite.com/oldfile.html which eventually got into their appropriate old category on the new page: http://www.newsite.com/oldsite/oldcategory/oldfile.html.

Got into Google Webmaster Tools and verified all sites. Next step was I told Google that old sites changed address to the new site which can be found in Google Webmaster Tools > 'select your website' > Configuration > Change of Address.

What happened after a while was the site that was hit by EMD update got back on track, almost. So I have decided to use another Google tool - disavow links, and clean up the spammy looking links, mainly from free directories and some questionable link exchanges.

Next step was to update the Social sites, Google+, Facebook, Twitter and so on. Because one of the sites got large number of followers I've decided to change the url and all details pointing to the new site, and this is where I have noticed something strange.
Now the URL of the Google + page was pointing to the index page of the new site, not to the appropriate category (old site). The Google+ page now directly communicates with the +1 button on your site, meaning if someone +1'd your site from Google+ it will display the number on your website and other way around.

The strangest thing happened when I've noticed the +1 on the index page and the category page, it was considered as one and the same page! Whenever someone +1'd the index page it counted it on the category page also.

After a while the category page was de-indexed from Google and in it's place Google displayed the index page with a catastrophic SERP. Have in mind that the old site had tons of incoming links, well established partner sites and so on.

I'm reading tons of materials about this but it seems I can't find an answer. What I have decided to do next is to redraw the change of address and leave only the 301 redirects because I can only change address to the root directory.

If someone has any idea I'll be more than happy to "hear" it.

Will keep you posted on the progress.