301 .htaccess redirect

301 .htaccess redirect

July 15, 2012

What is 301 redirect?

People access your site like http://yourdomain.com or http://www.yourdomain.com and they get same result but  both url are different for search engine. It means  http://yourdomain.com or http://www.yourdomain.com  are different domain. 301 redirect is the best method to preserve your current search engine rankings when redirecting web pages or a web site.  To implement a 301 redirect for websites that are hosted on servers running Apache, you'll need access to your server's .htaccess file. If your site is hosted on a server running other software, check with your hosting provider for details.

What is a .htaccess file?

The .htaccess file contains specific instructions for certain requests, including security, redirection issues and how to handle certain errors. When a visitor/spider requests a web page, your web server checks for a .htaccess file. You can create the .htaccess file using notepad. Just open the notepad, insert you code and save by putting "File Name" as .htaccess and "Save as type" should be set to "All" 301 htaccess redirect If you want to redirect http://yourdomain.com to http://www.yourdomain.com, first you've to enable the  mod_rewrite enabled on your server you can put below code in your .htaccess file: Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^yourdomain.com RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=permanent,L] or this:  Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^yourdomain.com$ [NC] RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]

Related Posts

from my blog


How To Reset Admin Password in Magento

January 20, 2017

As an ecommerce website developer or magento website developer, sometime we  get the a situation when we forget the magento website admin access detail. To reset the password of any...

Must Have Anti-Spam and Security WordPress Plugins

March 30, 2015

WordPress, is a hugely popular open source community platform which is also referred as a CMS. It's user friendly CMS that makes it very flexible and allows users to make...

WordPress v/s Joomla

March 20, 2015

Although there are a variety of content management systems (CMS) available in the market, but there aren’t many which can compete with Joomla and WordPress, both in terms of popularity...