Last update at :2024-01-18,Edit by888u
Readers who follow our blog should have discovered that the latest article links published by this site since yesterday no longer end with %post_id% but %post_id%.html. So how to solve the problem of article links that have been indexed by search engines? Is it %post_id%?
After all, the snapshot content generated by search engines still ends with %post_id%. If it is not processed, it will definitely 404 when opened. The solution is to 301 redirect www.laoliublog.cn/%post_id% to www.laoliublog.cn/%post_id%.html. This article will share the practical process of our blog with readers so that they can encounter it in the future. For reference.
In the early days of building our blog, for a while, the fixed link to the article page was set to www.laoliublog.cn/%post_id%.html. Later, I felt it was too long. Although it was said online that %post_id%.html was more conducive to SEO, It is best to change it to www.laoliublog.cn/%post_id based on personal preference.
In the past few days, I have been using Google’s mobile device suitability testing tool: https://search.google.com/test/mobile-friendly to test the usability of the article page and found that www.laoliublog.cn/%post_id% will report an error " The webpage is not suitable for browsing on mobile devices", www.laoliublog.cn/%post_id%.html displays "The webpage is suitable for browsing on mobile devices", because the content of the page crawled out by Google mobile crawler is "You Are Banned" ”, the reason is unknown to our blog. (Baidu Webmaster Platform mobile landing page detection is normal).
The following are some test results pictures of Google’s mobile device suitability testing tool:
The page is not suitable for viewing on mobile devices The page is suitable for browsing on mobile devicesSo our blog immediately reset the fixed link of the article page to www.laoliublog.cn/%post_id%.html, and made a 301 redirect to www.laoliublog.cn/%post_id% to www.laoliublog.cn/ %post_id%.html processing to prevent search engine snapshots from opening 404 and pass page authority.
Modify the fixed link of our blog site:
In the Nginx environment, add the following rules to the configuration file nginx.conf:
location ~ ^/(\d+)$ { rewrite ^(.*)$ $1.html permanent; }In the Apache environment, add the following rules to the configuration file .htaccess:
RedirectMatch 301 ^/(\d+)$ $1.htmlThe above is the method shared by our blog to implement 301 redirection from www.laoliublog.cn/%post_id% to www.laoliublog.cn/%post_id%.html. If you have any questions, please leave a message.
Recommended site search: rental server domain name registration number query, free IP, cloud host, special price space, personal virtual host, Hong Kong cloud host, Hong Kong server hosting, proxy IP address, free space in the United States,
发表评论