HolidayBuyer's Guide

Web Hosting, Design, & Coding forum

Question

How I can resolve canonicalization Issue?

by FunkiTech / February 27, 2014 8:00 PM PST

Hello Friends,

I have a website and canonical issue is related to it, the homepage of website is loaded with 4 different URL like with and without www , so how i can resolve this problem?
PLZ suggest me.

Discussion is locked
You are posting a reply to: How I can resolve canonicalization Issue?
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: How I can resolve canonicalization Issue?
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.

All Answers

Collapse -
Answer
The way you resolve that
by Sovereign Forum moderator / February 27, 2014 10:52 PM PST

is to setup redirects for your aliases.

For example, if you're using Apache, I'm assuming you have a virtual host that looks something like this:

<VirtualHost *:80>
ServerName domain.com
ServerAlias www.domain.com another.domain.com
...
</VirtualHost>

Which means the server will serve the DocumentRoot to all aliases as well.

Now, to prevent that, you need to setup a redirect.

One example would be to redirect www to non-www:

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

Another example might be to redirect any subdomain to non-www:

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

For even more examples, simple search for "redirect www to non-www" or if you want to include the www in your URLs, vise versa.

~Sovereign

Collapse -
Answer
You would talk to your DNS maintainer.
by R. Proffitt Forum moderator / February 27, 2014 10:55 PM PST
Collapse -
Answer
Solutions for solve canonical issue
by maryjohn01 / March 5, 2014 3:08 PM PST

Hi,

I am mary john. if your website is on Linux Server then sure below code will work for solve canonical issue.


Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com /$1 [L,R=301]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]


You have to copy and paste above code in .htaccess file . You have change only website name in above code.

I hope it will be helpful for you.

Thanks
Mary John
atechnocrat.com

Popular Forums
icon
Computer Newbies 10,686 discussions
icon
Computer Help 54,365 discussions
icon
Laptops 21,181 discussions
icon
Networking & Wireless 16,313 discussions
icon
Phones 17,137 discussions
icon
Security 31,287 discussions
icon
TVs & Home Theaters 22,101 discussions
icon
Windows 7 8,164 discussions
icon
Windows 10 2,657 discussions

The Samsung RF23M8090SG

One of the best French door fridges we've tested

A good-looking fridge with useful features like an auto-filling water pitcher and a temperature-adjustable "FlexZone" drawer. It was a near-flawless performer in our cooling tests.