Forum Moderators: phranque

Message Too Old, No Replies

versions of the site

         

Charlie88

12:34 pm on Feb 26, 2020 (gmt 0)

5+ Year Member



Hi,
1) If I have redirected / canonical (website on Wordpress):
http://example.com -> 301 -> https://example.com
http://www.example.com -> 301 -> https://example.com
https://www.example.com -> canonical -> https://example.com
https://example.com/index.php -> canonical -> https://example.com
It's the last 2 best to make 301 to the correct address, right?
IT specialist thinks that it is set on the server and Google doesn't have access to it. Through site: example.com, this is not seen either. It's better to add 301 after all, right?

2) I've got a few things on the page:
https://example.com/category/subcategory/string of numbers -> canonical-> https://example.com/category/subcategory/
https://example.com/anything/article/ -> canonical -> https://example.com/category/subcategory/
https://example.com/anything/article -> canonial -> https://example.com/anything/article/

it's also worth setting automatic redirections here in htaccess, right? Do you think that the lack of this may have a negative impact on website positioning?

Thanks for the help! :)

not2easy

2:34 pm on Feb 26, 2020 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



This part makes a difference in how things are handled ---> (website on Wordpress) because WP URLs will be shown in the format that is set in the Settings > General under "WordPress URL" and "Site URL".

In many cases a WP site is installed on a domain with existing content outside of the WP install. The settings to 301 all protocol requests to one URL format will always help a website's positioning because Google sees the content found at http://example.com/ and https://example.com/ and http://www.example.com/ and https://www.example.com/ and as duplicate content on different domains. If the content at "example.com" can be viewed in multiple ways, it will be seen in multiple ways by robots. The canonical metatag is helpful but since people who might link to your content can't guess what your canonical preference is, they may link to it in their preferred format. This is the reason to use .htaccess to send all visitors (human and robots) to your preferred format for your domain.

Be careful of setting canonicals in WP because it shows the same content and various URLs using the syntax in its "Settings". Yoast offers the best explanation I've seen on that topic: [yoast.com...]

Be Careful if you are changing your .htaccess file because the snippet of code for WP must be after your domain canonicalization 301s and you should never edit that code which is generated by WP.

There are hundreds, maybe thousands of discussions at WebmasterWorld on this topic, if you have time and want to learn more, try searching for "http to https rewrite" or "canonicalization" and you can be certain to understand all about it. ;)

lucy24

6:51 pm on Feb 26, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



https://example.com/index.php
URLs in "index.php"--or "index.anything"--shouldn't enter into discussions of canonicalness, because they should not exist in the first place.

Immediately before your domain-name-canonicalization redirect (the one that flattens http://example.com, http://www.example.com and https://www.example.com to your preferred https://example.com) there needs to be one that redirects any and all requests for /directory/index.php to /directory/ alone. If the site uses WP or other CMS, the redirect needs a RewriteCond looking at THE_REQUEST so things don't go around in circles; if the site doesn't use a CMS, the rule gets a [NS] flag instead.

not2easy

7:54 pm on Feb 26, 2020 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



You're right, lucy24. I did not address that because it is not clear if there is anything else on the site other than WP. If it is 100% WordPress, you don't rewrite /index anything because the WP snippet deals with that. It could be an issue if the site is WP and something else or has other directories outside of WP.

Sort of waiting for some response from Charlie88.

Charlie88

9:06 pm on Feb 26, 2020 (gmt 0)

5+ Year Member




Hi,

The site is only on Wordpress.

not2easy

10:02 pm on Feb 26, 2020 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



In that case, you can ignore the /index.php because WP deals with that, it cannot be visited even if you type it in.

You would not need to do a canonical redirect because it is controlled from within WordPress which will only use the Settings to determine what URLs will resolve. If for some reason you are seeing some URLs that don't match your Settings then something external is affecting it. WordPress works best when you don't need to correct any URLs. If the internal Settings were changed from http to https: you don't need to do any 301 redirects. What can negatively affect the canonical side of your content is if you are submitting sitemaps for every possible form of your posts or pages. Then it becomes a problem.

Google understands that WP will show the same content at various URLs and as long as you only submit one form of that content it is not a problem. If you have not read the article at Yoast, I suggest reading that because it becomes clear what you should do to benefit from WP, and why and how.

phranque

1:17 am on Feb 27, 2020 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



If you have not read the article at Yoast, I suggest reading that because it becomes clear what you should do to benefit from WP, and why and how.

the most important line from that yoast article relevant to your question is this:
If you are unsure whether to do a 301 redirect or set a canonical ... you should always do a redirect, unless there are technical reasons not to.

(source:https://yoast.com/rel-canonical/ [yoast.com])

lucy24

5:16 am on Feb 27, 2020 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



you should always do a redirect, unless there are technical reasons not to
A recommendation that applies universally, not just with WP plugins :)