[Tutorial] HTTP 301 www non-www redirection

Discuses methods of getting traffic though Blogging and Seo
Forum rules
This is a place for discussing legitimate ways to get people to click on your AdF.ly links, it is NOT a place to advertise sites to make money on the Internet. E.g. PTC sites. Any posts like will be deleted and accounts removed. Read the forum rules Here and Here before posting.
User avatar
surikan12
Pro Member
Posts: 127
Joined: Fri Apr 18, 2014 2:16 am

[Tutorial] HTTP 301 www non-www redirection

Postby surikan12 » Mon May 12, 2014 3:10 pm

THIS IS A FREAKING MUST IN SEO.

WHY IS THIS IMPORTANT?
google sees non-www and www domains as different. This means non-www and www domains will both be indexed and seens as duplicate content. THIS KILLS SEO.
Now, all you have to do is to decide if you like non-www or www better.


For Nginx - non-www to www

Code: Select all

server {
        listen 80;
        server_name yourwebsite;
        return 301 $scheme://www.yourwebsite$request_uri;
}

server {
        listen 80;
        server_name www.yourwebsite;
        root /path/to/your/website;
}


For Nginx - www to non-www

Code: Select all

server {
        listen 80;
        server_name www.yourwebsite;
        return 301 $scheme://www.yourwebsite$request_uri;
}

server {
        listen 80;
        server_name yourwebsite;
        root /path/to/your/website;
}


Apache - www to non-www

Code: Select all

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]


Apache - non-www to www

Code: Select all

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^YourSite.com$
RewriteRule ^(.*)$ http://www.yourSite.com/$1 [R=301]
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule ^(([^/]+/)*[^./]+)$ /$1.html [R=301,L]


Or simply (non-www to www)

Code: Select all

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

User avatar
SteveDushan
Registered Member
Posts: 20
Joined: Mon May 05, 2014 5:03 pm

Re: [Tutorial] HTTP 301 www non-www redirection

Postby SteveDushan » Mon May 19, 2014 7:32 am

I'm using 301 redirect to rank my sites really quick. What I do is find some expired domain with good backlink profile and google pagerank and 301 redirect it to my homepage. it works great! :D

User avatar
surikan12
Pro Member
Posts: 127
Joined: Fri Apr 18, 2014 2:16 am

Re: [Tutorial] HTTP 301 www non-www redirection

Postby surikan12 » Sat May 31, 2014 11:24 am

SteveDushan wrote:I'm using 301 redirect to rank my sites really quick. What I do is find some expired domain with good backlink profile and google pagerank and 301 redirect it to my homepage. it works great! :D


That's a good strategy
BUT!!!!!!!!! Remember, this is dangerous.
If google discovers this, there is a 80% chance they will penalize or sandbox your website.
Don't make it get too obvious.

User avatar
Yorika
Newbie
Posts: 1
Joined: Thu Jun 26, 2014 10:44 am
Location: www.trustedbots.com
Contact:

Re: [Tutorial] HTTP 301 www non-www redirection

Postby Yorika » Thu Jun 26, 2014 10:53 am

thnx for this informations ^^


Return to “Blogging & Seo”

Who is online

Users browsing this forum: No registered users and 2 guests