Mind blowing SEO improving and Google rank increasing Signature Rotator SEO Tool.

Thread: 

Redirec non-www to www with .htaccess

Ads
banner
banner
banner
ivan Offline referral

Posts: 713
Joined: Jul 2013
Reputation: 6

#1
Senior Member
Can you help me with .htaccess redirect? I need .htaccess canonical redirect from "www.domain.com" to "domain.com". Apache server!
invisibe_dude Offline referral

Posts: 820
Joined: May 2013
Reputation: 24

#2
Posting Freak
If you care about your search engine optimization (SEO) you have to be careful with canonical URL. Because what happens is that if you have "www.domain.com" and "domain.com" back links Google looks at this as not one domain but as two domain names so it is not good if you are trying to increase page rank. To fix that decide if you want your domain name to be with www or without www then use one of these .htaccess 301 redirect methods.

Redirect www to non
Code:
RewriteEngine on
rewritecond %{http_host} ^www.yourdomain.com [nc]
rewriterule ^(.*)$ http://yourdomain.com/$1 [r=301,nc]

Redirect non www to www
Code:
RewriteEngine on
rewritecond %{http_host} ^yourdomain.com [nc]
rewriterule ^(.*)$ http://www.yourdomain.com/$1 [r=301,nc]
gamer Offline referral

Posts: 192
Joined: May 2013
Reputation: 4

#3
Member
Why do you need to redirect www domain to non www?
invisibe_dude Offline referral

Posts: 820
Joined: May 2013
Reputation: 24

#4
Posting Freak
(02-07-2014 07:33 PM)gamer Wrote:  Why do you need to redirect www domain to non www?

It's called "canonical url".

Quote:"The one authoritatively correct URL for a resource. When a resource can be accessed via multiple URLs, a canonical URL should be identified. All alias URLs for a resource should redirect to the canonical URL to enforce its authority"





User(s) browsing this thread: 1 Guest(s)