{"id":2018,"date":"2024-09-24T14:27:09","date_gmt":"2024-09-24T06:27:09","guid":{"rendered":"https:\/\/www.ruianding.com\/blog\/?p=2018"},"modified":"2024-10-21T17:46:02","modified_gmt":"2024-10-21T09:46:02","slug":"website-migration-004-wordpress-debugging","status":"publish","type":"post","link":"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/","title":{"rendered":"Website Migration &#8211; Part 4: WordPress Debugging"},"content":{"rendered":"\n<p>After successfully migrating my WordPress site and restarting Apache, I encountered an issue where visiting any <strong>post<\/strong> or <strong>category<\/strong> (e.g., https:\/\/www.ruianding.com\/blog\/category\/azureadtopics\/aad-general\/) returned a <strong>404 error<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"2576\" height=\"1538\" src=\"https:\/\/www.ruianding.com\/blog\/wp-content\/uploads\/2024\/09\/image-30.png\" alt=\"\" class=\"wp-image-2019\" style=\"width:620px;height:auto\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">1. Identifying the Issue<\/h2>\n\n\n\n<p>The root cause seemed to be related to <strong>URL rewriting<\/strong>, which WordPress typically manages using the <strong><code>.htaccess<\/code><\/strong> file. Upon inspecting the directory, I realized that the <code>.htaccess<\/code> file was missing:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ls -la \/data\/ruianding.com\/blog\/.htaccess<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">2. Regenerating the .htaccess File<\/h2>\n\n\n\n<p>I attempted to regenerate the <code>.htaccess<\/code> rules via the WordPress <strong>Settings &gt; Permalinks<\/strong> section. After saving the permalink settings and restarting Apache, the issue still persisted.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"2810\" height=\"1454\" src=\"https:\/\/www.ruianding.com\/blog\/wp-content\/uploads\/2024\/09\/image-31.png\" alt=\"\" class=\"wp-image-2020\" style=\"width:645px;height:auto\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">3. Fixing the Permissions<\/h2>\n\n\n\n<p>Upon further investigation, I discovered that WordPress did not have sufficient permissions to write to the <code>.htaccess<\/code> file. To resolve this, I adjusted the ownership of the WordPress directory to allow <strong>Apache<\/strong> to manage the files:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo chown -R www-data:www-data \/data\/ruianding.com\/blog\/<\/pre>\n\n\n\n<p class=\"has-pale-cyan-blue-background-color has-background\">Previously, the WordPress website directory might have been owned by root or another user. If files were uploaded or extracted using root privileges, they would default to being owned by root. This command changes the ownership of the WordPress directory and its sub-files to www-data, which is the default user for Apache. This ensures that Apache has the necessary permissions to read, write, and manage files, allowing WordPress to execute background tasks (like generating the .htaccess file) successfully.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>After fixing the file permissions, WordPress was able to generate the <code>.htaccess<\/code> file correctly, resolving the 404 errors on posts and categories. This step finalized the migration process, with all key components\u2014<strong>Apache<\/strong>, <strong>MySQL<\/strong>, and <strong>WordPress<\/strong>\u2014working smoothly on the Linux server.<\/p>\n\n\n\n<p>With this, my entire website and blog migration from Windows to Linux is now complete \ud83c\udf8a!<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>After successfully migrating my WordPress site and restarting Apache, I encountered an issue where visiting any post or category (e.g., https:\/\/www.ruianding.com\/blog\/category\/azureadtopics\/aad-general\/) returned a 404 error. 1. Identifying the Issue The root cause seemed to be related to URL rewriting, which WordPress typically manages using the .htaccess file. Upon inspecting the directory, I realized that the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[58],"tags":[59],"class_list":["post-2018","post","type-post","status-publish","format-standard","hentry","category-siteandblogmigration","tag-migration"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Website Migration - Part 4: WordPress Debugging - \u6781\u7b80IT\uff5cSimpleIT<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Website Migration - Part 4: WordPress Debugging - \u6781\u7b80IT\uff5cSimpleIT\" \/>\n<meta property=\"og:description\" content=\"After successfully migrating my WordPress site and restarting Apache, I encountered an issue where visiting any post or category (e.g., https:\/\/www.ruianding.com\/blog\/category\/azureadtopics\/aad-general\/) returned a 404 error. 1. Identifying the Issue The root cause seemed to be related to URL rewriting, which WordPress typically manages using the .htaccess file. Upon inspecting the directory, I realized that the [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/\" \/>\n<meta property=\"og:site_name\" content=\"\u6781\u7b80IT\uff5cSimpleIT\" \/>\n<meta property=\"article:published_time\" content=\"2024-09-24T06:27:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-21T09:46:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.ruianding.com\/blog\/wp-content\/uploads\/2024\/09\/image-30.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2576\" \/>\n\t<meta property=\"og:image:height\" content=\"1538\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ruian Ding\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ruian Ding\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/\"},\"author\":{\"name\":\"Ruian Ding\",\"@id\":\"https:\/\/www.ruianding.com\/blog\/#\/schema\/person\/440d88575b7dc819a4cefc8c4199db3b\"},\"headline\":\"Website Migration &#8211; Part 4: WordPress Debugging\",\"datePublished\":\"2024-09-24T06:27:09+00:00\",\"dateModified\":\"2024-10-21T09:46:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/\"},\"wordCount\":269,\"publisher\":{\"@id\":\"https:\/\/www.ruianding.com\/blog\/#\/schema\/person\/440d88575b7dc819a4cefc8c4199db3b\"},\"image\":{\"@id\":\"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.ruianding.com\/blog\/wp-content\/uploads\/2024\/09\/image-30.png\",\"keywords\":[\"MIGRATION\"],\"articleSection\":[\"SiteAndBlogMigration\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/\",\"url\":\"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/\",\"name\":\"Website Migration - Part 4: WordPress Debugging - \u6781\u7b80IT\uff5cSimpleIT\",\"isPartOf\":{\"@id\":\"https:\/\/www.ruianding.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.ruianding.com\/blog\/wp-content\/uploads\/2024\/09\/image-30.png\",\"datePublished\":\"2024-09-24T06:27:09+00:00\",\"dateModified\":\"2024-10-21T09:46:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/#primaryimage\",\"url\":\"https:\/\/www.ruianding.com\/blog\/wp-content\/uploads\/2024\/09\/image-30.png\",\"contentUrl\":\"https:\/\/www.ruianding.com\/blog\/wp-content\/uploads\/2024\/09\/image-30.png\",\"width\":2576,\"height\":1538},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.ruianding.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Website Migration &#8211; Part 4: WordPress Debugging\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.ruianding.com\/blog\/#website\",\"url\":\"https:\/\/www.ruianding.com\/blog\/\",\"name\":\"Ruian's Tech Troubleshooting Toolbox\",\"description\":\"Debug the World.\",\"publisher\":{\"@id\":\"https:\/\/www.ruianding.com\/blog\/#\/schema\/person\/440d88575b7dc819a4cefc8c4199db3b\"},\"alternateName\":\"\u4e01\u777f\u5b89\u7684\u6280\u672f\u5206\u4eab\u535a\u5ba2\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.ruianding.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.ruianding.com\/blog\/#\/schema\/person\/440d88575b7dc819a4cefc8c4199db3b\",\"name\":\"Ruian Ding\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.ruianding.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.ruianding.com\/blog\/wp-content\/uploads\/2023\/05\/logo.png\",\"contentUrl\":\"https:\/\/www.ruianding.com\/blog\/wp-content\/uploads\/2023\/05\/logo.png\",\"width\":284,\"height\":284,\"caption\":\"Ruian Ding\"},\"logo\":{\"@id\":\"https:\/\/www.ruianding.com\/blog\/#\/schema\/person\/image\/\"},\"description\":\"I am currently a Support Specialist at NIO, focusing on cloud-related issues for NIO Power. Previously, at Microsoft Entra ID, I specialized in identity and access management (IAM), including device registration, Windows Hello for Business (WHfB), multi-factor authentication (MFA), and single sign-on (SSO). In addition to my core expertise, I have a strong foundation in Active Directory, Servers, Cloud Computing, Network Administration, and Front-end Web Development. This diverse technical skill set enables me to effectively handle a wide range of challenges in a fast-paced IT environment.\",\"sameAs\":[\"https:\/\/www.ruianding.com\"],\"url\":\"https:\/\/www.ruianding.com\/blog\/author\/ruiand\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Website Migration - Part 4: WordPress Debugging - \u6781\u7b80IT\uff5cSimpleIT","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/","og_locale":"en_US","og_type":"article","og_title":"Website Migration - Part 4: WordPress Debugging - \u6781\u7b80IT\uff5cSimpleIT","og_description":"After successfully migrating my WordPress site and restarting Apache, I encountered an issue where visiting any post or category (e.g., https:\/\/www.ruianding.com\/blog\/category\/azureadtopics\/aad-general\/) returned a 404 error. 1. Identifying the Issue The root cause seemed to be related to URL rewriting, which WordPress typically manages using the .htaccess file. Upon inspecting the directory, I realized that the [&hellip;]","og_url":"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/","og_site_name":"\u6781\u7b80IT\uff5cSimpleIT","article_published_time":"2024-09-24T06:27:09+00:00","article_modified_time":"2024-10-21T09:46:02+00:00","og_image":[{"width":2576,"height":1538,"url":"https:\/\/www.ruianding.com\/blog\/wp-content\/uploads\/2024\/09\/image-30.png","type":"image\/png"}],"author":"Ruian Ding","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Ruian Ding","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/#article","isPartOf":{"@id":"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/"},"author":{"name":"Ruian Ding","@id":"https:\/\/www.ruianding.com\/blog\/#\/schema\/person\/440d88575b7dc819a4cefc8c4199db3b"},"headline":"Website Migration &#8211; Part 4: WordPress Debugging","datePublished":"2024-09-24T06:27:09+00:00","dateModified":"2024-10-21T09:46:02+00:00","mainEntityOfPage":{"@id":"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/"},"wordCount":269,"publisher":{"@id":"https:\/\/www.ruianding.com\/blog\/#\/schema\/person\/440d88575b7dc819a4cefc8c4199db3b"},"image":{"@id":"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/#primaryimage"},"thumbnailUrl":"https:\/\/www.ruianding.com\/blog\/wp-content\/uploads\/2024\/09\/image-30.png","keywords":["MIGRATION"],"articleSection":["SiteAndBlogMigration"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/","url":"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/","name":"Website Migration - Part 4: WordPress Debugging - \u6781\u7b80IT\uff5cSimpleIT","isPartOf":{"@id":"https:\/\/www.ruianding.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/#primaryimage"},"image":{"@id":"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/#primaryimage"},"thumbnailUrl":"https:\/\/www.ruianding.com\/blog\/wp-content\/uploads\/2024\/09\/image-30.png","datePublished":"2024-09-24T06:27:09+00:00","dateModified":"2024-10-21T09:46:02+00:00","breadcrumb":{"@id":"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/#primaryimage","url":"https:\/\/www.ruianding.com\/blog\/wp-content\/uploads\/2024\/09\/image-30.png","contentUrl":"https:\/\/www.ruianding.com\/blog\/wp-content\/uploads\/2024\/09\/image-30.png","width":2576,"height":1538},{"@type":"BreadcrumbList","@id":"https:\/\/www.ruianding.com\/blog\/website-migration-004-wordpress-debugging\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.ruianding.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Website Migration &#8211; Part 4: WordPress Debugging"}]},{"@type":"WebSite","@id":"https:\/\/www.ruianding.com\/blog\/#website","url":"https:\/\/www.ruianding.com\/blog\/","name":"Ruian's Tech Troubleshooting Toolbox","description":"Debug the World.","publisher":{"@id":"https:\/\/www.ruianding.com\/blog\/#\/schema\/person\/440d88575b7dc819a4cefc8c4199db3b"},"alternateName":"\u4e01\u777f\u5b89\u7684\u6280\u672f\u5206\u4eab\u535a\u5ba2","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.ruianding.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.ruianding.com\/blog\/#\/schema\/person\/440d88575b7dc819a4cefc8c4199db3b","name":"Ruian Ding","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.ruianding.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/www.ruianding.com\/blog\/wp-content\/uploads\/2023\/05\/logo.png","contentUrl":"https:\/\/www.ruianding.com\/blog\/wp-content\/uploads\/2023\/05\/logo.png","width":284,"height":284,"caption":"Ruian Ding"},"logo":{"@id":"https:\/\/www.ruianding.com\/blog\/#\/schema\/person\/image\/"},"description":"I am currently a Support Specialist at NIO, focusing on cloud-related issues for NIO Power. Previously, at Microsoft Entra ID, I specialized in identity and access management (IAM), including device registration, Windows Hello for Business (WHfB), multi-factor authentication (MFA), and single sign-on (SSO). In addition to my core expertise, I have a strong foundation in Active Directory, Servers, Cloud Computing, Network Administration, and Front-end Web Development. This diverse technical skill set enables me to effectively handle a wide range of challenges in a fast-paced IT environment.","sameAs":["https:\/\/www.ruianding.com"],"url":"https:\/\/www.ruianding.com\/blog\/author\/ruiand\/"}]}},"_links":{"self":[{"href":"https:\/\/www.ruianding.com\/blog\/wp-json\/wp\/v2\/posts\/2018","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ruianding.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ruianding.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ruianding.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ruianding.com\/blog\/wp-json\/wp\/v2\/comments?post=2018"}],"version-history":[{"count":5,"href":"https:\/\/www.ruianding.com\/blog\/wp-json\/wp\/v2\/posts\/2018\/revisions"}],"predecessor-version":[{"id":2111,"href":"https:\/\/www.ruianding.com\/blog\/wp-json\/wp\/v2\/posts\/2018\/revisions\/2111"}],"wp:attachment":[{"href":"https:\/\/www.ruianding.com\/blog\/wp-json\/wp\/v2\/media?parent=2018"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ruianding.com\/blog\/wp-json\/wp\/v2\/categories?post=2018"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ruianding.com\/blog\/wp-json\/wp\/v2\/tags?post=2018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}