Showing posts with label Apache. Show all posts
Showing posts with label Apache. Show all posts

Wednesday, February 6, 2013

Domains with www. and without www


The search engines like Google , Yahoo , Bing , and others, do not like that there is content duplicated on the web, for example, is very common that a given domain has two inputs, with www and without www at the beginning ( www . dominio.com and dominio.com ). This can present problems for our site because if you Google our Pagerank , rather thanincrease , may be affected . To avoid duplication of pages registered, we will have to make a decision.
There are several ways to force the system to using a 301 redirect , our domination takes one of two forms . For those working on a server Apache and therefore have the ability to create and edit a file . htaccess in the root of your server, you can choose to add one of the following codes:
If we want all accesses are redirected to a domain with www, we add:

RewriteEngine On
HTTPHOST RewriteCond% {}! ^ Www.
RewriteRule ^ (. *) $ Http://www.% {HTTPHOST} / $ 1 [R = 301, L]

If our intention is to remove the prefix www to our access, this is the code:


RewriteEngine On
RewriteCond% {HTTP_HOST} ^ www. (.) $
RewriteRule ^ (.) $ Http://% 1 / $ 1 [R = 301, L]
The choice is yours. You must choose one of the two.

Friday, February 1, 2013

What is 301 redirect? and how to make it


In going from one location on our website page Web access to it from other pages that link to get lost besides those who visit us from a search engine like Google will not find the page.
What we have to do is try to set up the page so that when the search engine robot know that the page has changed location permanently, for this we will use the 301 redirect, it should be noted that this state passes values PageRank for Google and the number of pages that link.
The 301 redirect is a state of the protocol standards HTTP , here are some ways to do it.

301 redirect with PHP

The redirect page we will replace it with a PHP file with the following code:
<? Php
header ("HTTP/1.1 301 Moved Permanently");
header ("location: http://www.neoideas.com.mx");
?>
It is important that this code is to the beginning of the php file (the first line).

301 redirect with ASP

The redirect page we will replace it with an ASP file with the following code:
<%
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", "http://www.url-de-la-nueva-direccion.com"
%>

301 redirect with ASP.NET

The redirect page we will replace it with an ASP file with the following code:

private void Page_Load (object sender, System.EventArgs e)
{
    Response.Status = "Moved Permanently";
    Response.AddHeader ("Location, http://www.url-nueva.com");
}

301 redirect with ColdFusion

The page that we will redirect ColdFusion replaced by a file with the following code:
<. Cfheader statuscode = "301" statusText = "Moved permanently">
<. Cfheader name = "Location" value = "http://www.url-de-la-nueva-direccion.com">

301 redirect with Apache

You create a. Htaccess (if not, if you edit the current one) in your root directory and add the following line:
Redirect 301 / http://www.url-de-la-nueva-direccion.com

Redireción 301 on an IIS server

We need to configure the server by entering the Internet Services Manager as follows:
  1. Select the "redirection to a URL"
  2. Enter the page that will redirect
  3. Check the URL introduced as "a permanent redirection for this resource"
  4. Click "Apply"

301 redirect from an HTML

This type of redirection is not possible, it is necessary for any of the above methods or access server configuration.
Note that in all these forms of redirection http://www.url-de-la-nueva-direccion.com need to change the new URL.