Last updated: November 27, 2023 at 1:34 PM
As the title suggests, the official URL (https://www.senris.com) of this site has been changed from www to https://senris.com.
This can be easily normalized by simply removing the www description from the WordPress address (URL) and site address (URL) in the general settings of the WordPress extranet.
However, after URL normalization, the WordPress plugin Site Kit by Google now requires reconnection to Search Console, AdSense, Analytics, and PageSpeed Insights.
Later, we also associated Search Console Insights with Google Analytics 4 Properties in the Google Search console.
Regarding Google Search Console settings, we are currently moving to domain properties, but it is necessary to register URLs without www in the index, so when we asked Google Index to register URLs without www, we received the following warning. was displayed.
Duplicate. Google has selected a page as canonical page that is different from the page you marked
https://search.google.com › search-console
Basically, it seems that the URL registered at the beginning is judged to be canonical, so it seems difficult to change the URL from the middle when it comes to Google indexing.
Due to URL normalization, the following plugins caused several link errors in internal links to www: Therefore, the Pz card management tool repaired the link error in the relevant part.
URL normalization should be completed by simply changing the WordPress configuration, but the cause of the link error in Pz card management is not clear. However, since we were able to repair it for the time being, we will complete this work.
By the way, if you need to consider "CDN", it is better to have www in the URL, but since it is not relevant for this site that does not care about CDN, we decided to unify it with a URL without www which can be shortened.
2022.07.25 Update
Program fix for SSL support for the number of Facebook likes
When we normalized URLs, the Facebook "like" number set on the homepage went wrong.
When I checked with Facebook's Share Debugger, there was a mistake in constructing the og:url property of the homepage. The cause was a mistake in the program that displayed social buttons, and as a result of not having a www URL, it was impossible to judge whether it was a homepage or not.
An old article written in the "http://" era notifies Facebook crawlers of og:url properties at the old URL and tells them to get old likes! I will keep the number, but the logic of excluding only the top page from this processing was broken.
There were two corrections in social_buttons.php. Below are the Facebook Likes Fixed code for the button display and OGP tag setting section.
$fb_appid = get_option('hpb_social_facebook_app_id');
$STR_DATA_HREF = get_permalink();
if ( 20200206 >= intval(get_the_date('Ymd')) ) {
if ( $STR_DATA_HREF !== 'https://www.senris.com/' and $STR_DATA_HREF !== 'https://senris.com/' ) {
// TOPページ以外でなおかつSSL化前の記事だけ data-href のURLを古いURLに変更する
$STR_DATA_HREF = str_replace( 'https://', 'http://',$STR_DATA_HREF);
}
}
$STR_OGP_URL = $STR_DATA_HREF; // og:url
// Facebookいいね!ボタン表示
$facebook_like = '<div id="fb-root"></div>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/ja_JP/sdk.js#xfbml=1&version=v14.0&appId='.$fb_appid.'&autoLogAppEvents=1 nonce="********"></script>
<div class="fb-like" data-href="'.$STR_DATA_HREF.'" data-send="false" data-layout="'.$facebook_like_layout.'" data-width="'.$facebook_like_width.'" data-size="small" data-share="true"></div>'."\n";
$content_social .= $facebook_like;
・
・
// 以下は、再度、3~10行の処理を実行してから
// ↓
<meta property="og:title" content="<?php the_title(); ?> | <?php bloginfo('name'); ?>"/>
<meta property="og:url" content="<?php echo esc_url($STR_OGP_URL); ?>"/>
<meta property="og:image" content="<?php echo esc_url(hpb_get_thumbnail_url($id,'large')); ?>"/>
<meta property="og:image" content="<?php echo esc_url(hpb_get_thumbnail_url($id,'medium')); ?>"/>
・
・
function hpb_get_thumbnail_url( $id, $size ) {
// OGP用サムネイル画像のURL取得
$thumbnail_url = get_the_post_thumbnail_url($id, $size);
if ( !$thumbnail_url ) {
$query = 'post_parent=' . $id . '&post_type=attachment&post_mime_type=image';
$postImg = get_children($query);
if ( !empty($postImg) ){
$keys = array_keys($postImg);
$num = $keys[sizeOf($keys)-1];
$thumb = wp_get_attachment_image_src($num, $size);
$thumbnail_url = clean_url($thumb[0]);
} else {
$thumbnail_url = get_bloginfo('template_directory').'/screenshot.jpg';
}
}
return $thumbnail_url;
}
📝 The value (*) described in "nonce="********"" in line 14 isFacebook for DevelopmentsEnter the value obtained from .
Social buttons are explained in detail in the following articles.
This time, it took 3 days to do all the work, but along with URL normalization, we added a security plugin to WordPress. Solid Security (iThemes Security) A CGI program for image bulletin boards that is responsive to smartphones and has enhanced security. Joyful Note X v2.0 I replaced it with
After that, I replaced the breadcrumbs generation program (compatible with schema.org), deleted "Google+" in the SNS button settings on the management screen, changed the script and icon of SNS such as Hatena Bookmark, Twitter to the latest version. These are borrowed from the hpb22 demo program “social_buttons.php”. 😅
2022.07.26 Update
Google indexing
When I checked https://senris.com in the URL inspection of the Google Search Console today, I received the message "The URL is registered with Google" as shown below.
It looks like the normalized URL has been successfully indexed by Google.
Along with URL normalization, "Structured Data JSON-LD + schema.org", a data format that presents the contents of a website so that Google crawlers can grasp it structurally, is changed to the WordPress plugin "Markup (JSON-LD) structured in schema.org" introduced in the following article. We also changed the setting in .
The Google Search Console does all of this and then sends a new normalized URL.
2022.08.01 update
As you can see below, with the introduction of Yoast SEO, the plug-ins "Markup (JSON-LD) structured in schema.org", "hpb seo plugin for WordPress" and "Google XML Sitemaps" became unnecessary, so I uninstalled them.
Also, the breadcrumb generator has been replaced with hpb22's breadcrumb.php.