{"id":14201,"date":"2012-07-05T21:01:08","date_gmt":"2012-07-05T13:01:08","guid":{"rendered":"https:\/\/www.hongkiat.com\/blog\/?p=14201"},"modified":"2025-04-04T01:10:43","modified_gmt":"2025-04-03T17:10:43","slug":"wordpress-url-rewrite","status":"publish","type":"post","link":"https:\/\/www.hongkiat.com\/blog\/wordpress-url-rewrite\/","title":{"rendered":"Rewriting URLs in WordPress: Tips and Plugins"},"content":{"rendered":"<p>Recent updates to WordPress make it easier than ever for developers to personalize their websites. You can effortlessly modify your theme, switch out sidebar widgets, and even create your own custom PHP functions. One popular feature is the ability to customize URL permalinks to make them more user-friendly.<\/p>\n<p>In this guide, we\u2019ll explore different ways to modify WordPress\u2019s default URL rewriting system. While some knowledge of PHP is helpful, the process is straightforward enough that you can simply copy and paste the code into your own template.<\/p>\n<h2>Understanding WP_Rewrite<\/h2>\n<p>If you\u2019ve worked with mod_rewrite on Apache servers, you\u2019ll find WordPress\u2019s rewrite system quite similar. WordPress also uses an <em>.htaccess<\/em> file, but the rules are written in PHP. This gives you more flexibility in customizing your URLs.<\/p>\n<p>For a deep dive, check out the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/developer.wordpress.org\/reference\/classes\/wp_rewrite\/\">$wp_rewrite class documentation<\/a>. It\u2019s filled with useful information and examples. You can add most of the code directly to your theme\u2019s <strong>functions.php<\/strong> file. Let\u2019s first explore the default rewrite rules that come with WordPress.<\/p>\n<h3>Content of $wp_rewrite-&gt;rules<\/h3>\n<p>By making the <code>$wp_rewrite<\/code> class global, you can access its internal data. Your custom rules will be stored in an array named <code>$wp_rewrite->rules<\/code>. Keep this variable in mind, as you\u2019ll likely refer to it multiple times during development.<\/p>\n<pre>\r\n&lt;div&gt;&lt;code&gt;\r\n &lt;?php\r\n global $wp_rewrite;\r\n print_r($wp_rewrite->rules);\r\n ?&gt;\r\n&lt;\/code&gt;&lt;\/div&gt;\r\n<\/pre>\n<p>I included this code snippet in my theme\u2019s <strong>page.php<\/strong> file. It displays a large array that might seem confusing at first. However, if you <strong>View Source<\/strong> on your webpage, you\u2019ll find it easier to understand how each rewrite rule corresponds to a specific filename. For instance, let\u2019s examine the rules for category rewrites:<\/p>\n<pre>\r\n[category\/(.+?)\/?$] => index.php?category_name=$matches[1]\r\n<\/pre>\n<p>The part inside the brackets on the left is the Apache RewriteRule to look for. It starts with <em>\/category\/<\/em> followed by any string of characters. When this pattern is matched, the server knows to use <code>index.php?category_name=<\/code> and replace the variable at the end.<\/p>\n<h2>How to Set Up Custom Permalinks<\/h2>\n<p>WordPress has a class called <code>$wp_rewrite<\/code> that offers various options for URL structures. You can access properties like <code>$wp_rewrite->category_base<\/code> or <code>$wp_rewrite->author_base<\/code> to get the default URL settings. You can also create your own custom URL rules.<\/p>\n<h3>Changing the Author URL Structure<\/h3>\n<p>When you visit the Permalinks settings in WordPress, you can change the URL structures for categories and tags. However, strangely, there\u2019s no option to change the author URL structure.<\/p>\n<p>You can use the <code>add_rewrite_rule()<\/code> function from WordPress to add new URL settings. For example, I\u2019ve changed the default <strong>\/author\/<\/strong> to <strong>\/writer\/<\/strong>. You can choose any base you like. Below is a code snippet that you can add to your theme\u2019s <code>functions.php<\/code> file to make these changes.<\/p>\n<pre>\r\nadd_action('init', 'add_author_rules');\r\n\r\nfunction add_author_rules() {\r\n  add_rewrite_rule(\r\n    \"writer\/([^\/]+)\/?\",\r\n    \"index.php?author_name=$matches[1]\",\r\n    \"top\"\r\n  );\r\n\r\n  add_rewrite_rule(\r\n    \"writer\/([^\/]+)\/page\/?([0-9]{1,})\/?\",\r\n    \"index.php?author_name=$matches[1]&paged=$matches[2]\",\r\n    \"top\"\r\n  );\r\n\r\n  add_rewrite_rule(\r\n    \"writer\/([^\/]+)\/(feed|rdf|rss|rss2|atom)\/?\",\r\n    \"index.php?author_name=$matches[1]&feed=$matches[2]\",\r\n    \"top\"\r\n  );\r\n\r\n  add_rewrite_rule(\r\n    \"writer\/([^\/]+)\/feed\/(feed|rdf|rss|rss2|atom)\/?\",\r\n    \"index.php?author_name=$matches[1]&feed=$matches[2]\",\r\n    \"top\"\r\n  );\r\n}\r\n<\/pre>\n<p>You can use this function without needing the <code>$wp_rewrite<\/code> variable. Some developers prefer this approach because it\u2019s easier than using class properties. However, be aware that this method may not work consistently for all WordPress setups. You can also add these rules after updating your .htaccess file (explained later).<\/p>\n<h3>How to Set Up Author URLs Using generate_rewrite_rules<\/h3>\n<p>To use this method, you\u2019ll need to access the global <code>$wp_rewrite<\/code> class. Then, create a new variable called <code>$new_rules<\/code> that holds an array of data. The example code below sets up URL rewriting for basic author pages.<\/p>\n<pre>\r\nfunction generate_author_rewrite_rules() {\r\n  global $wp_rewrite;\r\n  $new_rules = array(\r\n    \"writer\/([^\/]+)\/?\" => \"index.php?author_name=\" . $wp_rewrite->preg_index(1)\r\n  );\r\n  $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;\r\n}\r\n<\/pre>\n<p>If you want to include multiple pages and RSS feeds, you can expand the array. You can either create a PHP function to <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/jaswanttak.wordpress.com\/2010\/04\/23\/php-associative-array-push\/\">add more data to the array<\/a> or separate the data blocks with commas. Here\u2019s an updated version of the code:<\/p>\n<pre>\r\nfunction generate_author_rewrite_rules() {\r\n  global $wp_rewrite;\r\n  $new_rules = array(\r\n    \"writer\/([^\/]+)\/?\" => \"index.php?author_name=\" . $wp_rewrite->preg_index(1),\r\n    \"writer\/([^\/]+)\/page\/?([0-9]{1,})\/?\" => \"index.php?author_name=\" . $wp_rewrite->preg_index(1) . \"&paged=\" . $wp_rewrite->preg_index(2),\r\n    \"writer\/([^\/]+)\/(feed|rdf|rss|rss2|atom)\/?\" => \"index.php?author_name=\" . $wp_rewrite->preg_index(1) . \"&feed=\" . $wp_rewrite->preg_index(2),\r\n    \"writer\/([^\/]+)\/feed\/(feed|rdf|rss|rss2|atom)\/?\" => \"index.php?author_name=\" . $wp_rewrite->preg_index(1) . \"&feed=\" . $wp_rewrite->preg_index(2)\r\n  );\r\n  $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;\r\n}\r\n<\/pre>\n<p>Remember, these changes won\u2019t take effect until you\u2019ve updated the original URL rewrite rules. You\u2019ll need to do this every time you modify these functions. After that, your new rules will stay in place.<\/p>\n<h3>How to Update URL Rewrite Rules<\/h3>\n<p>Changes to the URL rewrite code don\u2019t happen instantly. You need to update the .htaccess file for the new code to work. Doing this every time a page loads is inefficient because it writes to the database and refreshes the .htaccess file.<\/p>\n<p>A better way is to go to your permalinks page in the WordPress admin panel and save the changes again. This triggers a <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/codex.wordpress.org\/Function_Reference\/flush_rewrite_rules\">flush_rewrite_rules<\/a>, so you don\u2019t have to worry about loading issues for users. You only need to save the page once to update all the rules.<\/p>\n<h2>How to Use Non-WordPress Rules<\/h2>\n<p>In the <code>$wp_rewrite<\/code> class, you can find many options. One important option is <code>$wp_rewrite->non_wp_rules<\/code>. This is an array that stores redirects that don\u2019t go through the index.php file.<\/p>\n<p>This feature is commonly used in WordPress plugin development. For example, you can redirect a custom URL like <code>\/calendar\/june-2012\/<\/code> to a specific file in your website\u2019s backend, like <code>\/wp-content\/plugins\/calendarplug\/myscript.php<\/code>. Below, you\u2019ll find a detailed example that explains how to use this array for custom rewrite rules.<\/p>\n<h3>How to Hide Your Theme Files<\/h3>\n<p>Many WordPress users recommend hiding the actual paths to theme files. For instance, you might want to access files in the <code>\/wp-content\/themes\/mytheme\/<\/code> folder using a cleaner URL. To do this, you\u2019ll need to set up some special WordPress rewrite rules.<\/p>\n<p>Normally, WordPress routes all content through a single file, usually index.php. But if you want to hide the paths to your theme files, you\u2019ll need to set up rules for multiple files.<\/p>\n<pre>\r\nadd_action('generate_rewrite_rules', 'themes_dir_add_rewrites');\r\n\r\nfunction themes_dir_add_rewrites() {\r\n  $theme_name = next(explode('\/themes\/', get_stylesheet_directory()));\r\n  \r\n  global $wp_rewrite;\r\n  $new_non_wp_rules = array(\r\n    'css\/(.*)' => 'wp-content\/themes\/' . $theme_name . '\/css\/$1',\r\n    'js\/(.*)' => 'wp-content\/themes\/' . $theme_name . '\/js\/$1',\r\n    'images\/wordpress-urls-rewrite\/(.*)' => 'wp-content\/themes\/' . $theme_name . '\/images\/wordpress-urls-rewrite\/$1',\r\n  );\r\n  $wp_rewrite->non_wp_rules += $new_non_wp_rules;\r\n}\r\n<\/pre>\n<p>I\u2019ve created a new function called <code>themes_dir_add_rewrites()<\/code>. This function takes the long URLs and redirects them to shorter, cleaner ones. It uses the <code>non_wp_rules<\/code> option in the <code>$wp_rewrite<\/code> class, which allows for server-side handling instead of routing through WordPress\u2019s index.php.<\/p>\n<p>The advantage of using these non-WordPress rules is flexibility. You can still use the old URL format if you want. For example:<\/p>\n<p><code>\/wp-content\/themes\/mytheme\/images\/wordpress-urls-rewrite\/logo.jpg<\/code><\/p>\n<p>But it\u2019s much cleaner to use:<\/p>\n<p><code>\/images\/wordpress-urls-rewrite\/logo.jpg<\/code> instead.<\/p>\n<h2>Useful Tools and Plugins for URL Rewriting<\/h2>\n<p>If you\u2019re new to coding custom URLs, don\u2019t worry-it can be challenging at first. But practice makes perfect! To help you get started, here are some useful tools and plugins. You might not need all of them, but they\u2019re great resources for anyone working with WordPress URL rewrites.<\/p>\n<h3><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/wordpress.org\/\/extend\/plugins\/monkeyman-rewrite-analyzer\/\">Monkeyman Rewrite Analyzer<\/a><\/h3>\n<p>This plugin is essential for beginners in URL rewriting. It doesn\u2019t modify your website\u2019s existing rules; it simply lets you test your code to see how URLs will redirect. It\u2019s also useful for testing custom query variables for any custom post types.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/wordpress-urls-rewrite\/rewrite-analyzer-screen2.jpg\" alt=\"Monkeyman Rewrite Analyzer interface\" width=\"500\" height=\"190\"><\/figure>\n<h3><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/wordpress.org\/\/extend\/plugins\/askapaches-rewriterules-viewer\/\">AskApache RewriteRules Viewer<\/a><\/h3>\n<p>This plugin is similar to Monkeyman Rewrite Analyzer, but it doesn\u2019t allow you to test your own rules. Instead, it displays all the default WordPress rules and their corresponding redirects. It shows key properties of <code>$wp_rewrite<\/code>, like permalink settings and bases for pages, categories, and tags.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/wordpress-urls-rewrite\/askapache-rewrite-plugins-root.jpg\" alt=\"AskApache RewriteRules Viewer interface\" width=\"500\" height=\"302\"><\/figure>\n<h3><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/wordpress.org\/\/extend\/plugins\/wp-htaccess-control\/\">WP htaccess Control<\/a><\/h3>\n<p>This plugin offers a different approach to creating new page redirects. It comes with an admin panel where you can edit various settings, including your author and page bases. You can also add your own custom .htaccess rules directly.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/wordpress-urls-rewrite\/wp-htaccess-control.jpg\" alt=\"WP htaccess Control admin panel\" width=\"500\" height=\"302\"><\/figure>\n<h3><a rel=\"nofollow noopener\" target=\"_blank\" href=\"http:\/\/martinmelin.se\/rewrite-rule-tester\/\">Rewrite Rule Tester<\/a><\/h3>\n<p>This isn\u2019t a WordPress plugin, but it\u2019s a useful tool for testing rewrite rules. You can copy and test your rules without modifying your .htaccess file, making it easier to debug your code before going live.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/assets.hongkiat.com\/uploads\/wordpress-urls-rewrite\/rewrite-rules-tester-webapp.jpg\" alt=\"Rewrite Rule Tester web application\" width=\"500\" height=\"302\"><\/figure>\n<h3><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/wordpress.org\/\/extend\/plugins\/dw-rewrite\/\">DW ReWrite<\/a><\/h3>\n<p>DW ReWrite is a straightforward plugin that automatically creates three clean URLs for admin, login, and registration pages. It replaces the default, more complicated WordPress registration URL with simpler versions like <code>\/admin<\/code>, <code>\/login<\/code>, and <code>\/register<\/code>.<\/p>\n<h2>Conclusion<\/h2>\n<p>I hope this guide helps you understand the basics of WordPress URL rewriting. WordPress is a popular CMS with constant updates and new features. Customizing your URLs can significantly enhance your website\u2019s user experience and branding.<\/p>\n<p>If you run into issues with your rewrite rules, don\u2019t panic. You can easily revert the changes by deleting the function code and refreshing your .htaccess file. Feel free to explore more articles on this topic, and if you have any questions or comments, share them in the post discussion area.<\/p>","protected":false},"excerpt":{"rendered":"<p>Recent updates to WordPress make it easier than ever for developers to personalize their websites. You can effortlessly modify your theme, switch out sidebar widgets, and even create your own custom PHP functions. One popular feature is the ability to customize URL permalinks to make them more user-friendly. In this guide, we\u2019ll explore different ways&hellip;<\/p>\n","protected":false},"author":18,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[49],"tags":[4663,3323,252],"topic":[4520],"class_list":["entry-content","is-maxi"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.8 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Rewriting URLs in WordPress: Tips and Plugins - Hongkiat<\/title>\n<meta name=\"description\" content=\"Recent updates to WordPress make it easier than ever for developers to personalize their websites. You can effortlessly modify your theme, switch out\" \/>\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.hongkiat.com\/blog\/wordpress-url-rewrite\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Rewriting URLs in WordPress: Tips and Plugins\" \/>\n<meta property=\"og:description\" content=\"Recent updates to WordPress make it easier than ever for developers to personalize their websites. You can effortlessly modify your theme, switch out\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hongkiat.com\/blog\/wordpress-url-rewrite\/\" \/>\n<meta property=\"og:site_name\" content=\"Hongkiat\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/hongkiatcom\" \/>\n<meta property=\"article:published_time\" content=\"2012-07-05T13:01:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-03T17:10:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/assets.hongkiat.com\/uploads\/wordpress-urls-rewrite\/rewrite-analyzer-screen2.jpg\" \/>\n<meta name=\"author\" content=\"Jake Rocheleau\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:site\" content=\"@hongkiat\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jake Rocheleau\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-url-rewrite\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-url-rewrite\\\/\"},\"author\":{\"name\":\"Jake Rocheleau\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/966b2daea15283b4145e71aa98a82c2a\"},\"headline\":\"Rewriting URLs in WordPress: Tips and Plugins\",\"datePublished\":\"2012-07-05T13:01:08+00:00\",\"dateModified\":\"2025-04-03T17:10:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-url-rewrite\\\/\"},\"wordCount\":1274,\"commentCount\":15,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-url-rewrite\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/wordpress-urls-rewrite\\\/rewrite-analyzer-screen2.jpg\",\"keywords\":[\"ad-divi\",\"WordPress Plugins\",\"WordPress Tips\"],\"articleSection\":[\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-url-rewrite\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-url-rewrite\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-url-rewrite\\\/\",\"name\":\"Rewriting URLs in WordPress: Tips and Plugins - Hongkiat\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-url-rewrite\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-url-rewrite\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/wordpress-urls-rewrite\\\/rewrite-analyzer-screen2.jpg\",\"datePublished\":\"2012-07-05T13:01:08+00:00\",\"dateModified\":\"2025-04-03T17:10:43+00:00\",\"description\":\"Recent updates to WordPress make it easier than ever for developers to personalize their websites. You can effortlessly modify your theme, switch out\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-url-rewrite\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-url-rewrite\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-url-rewrite\\\/#primaryimage\",\"url\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/wordpress-urls-rewrite\\\/rewrite-analyzer-screen2.jpg\",\"contentUrl\":\"https:\\\/\\\/assets.hongkiat.com\\\/uploads\\\/wordpress-urls-rewrite\\\/rewrite-analyzer-screen2.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wordpress-url-rewrite\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Rewriting URLs in WordPress: Tips and Plugins\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"name\":\"Hongkiat\",\"description\":\"Tech and Design Tips\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#organization\",\"name\":\"Hongkiat.com\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"contentUrl\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/wp-content\\\/uploads\\\/hkdc-logo-rect-yoast.jpg\",\"width\":1200,\"height\":799,\"caption\":\"Hongkiat.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/hongkiatcom\",\"https:\\\/\\\/x.com\\\/hongkiat\",\"https:\\\/\\\/www.pinterest.com\\\/hongkiat\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/#\\\/schema\\\/person\\\/966b2daea15283b4145e71aa98a82c2a\",\"name\":\"Jake Rocheleau\",\"description\":\"Jake is a writer and designer with over 10 years experience working on the web. He writes about user experience design and cool resources for designers\",\"sameAs\":[\"https:\\\/\\\/www.hongkiat.com\"],\"url\":\"https:\\\/\\\/www.hongkiat.com\\\/blog\\\/author\\\/jake\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Rewriting URLs in WordPress: Tips and Plugins - Hongkiat","description":"Recent updates to WordPress make it easier than ever for developers to personalize their websites. You can effortlessly modify your theme, switch out","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.hongkiat.com\/blog\/wordpress-url-rewrite\/","og_locale":"en_US","og_type":"article","og_title":"Rewriting URLs in WordPress: Tips and Plugins","og_description":"Recent updates to WordPress make it easier than ever for developers to personalize their websites. You can effortlessly modify your theme, switch out","og_url":"https:\/\/www.hongkiat.com\/blog\/wordpress-url-rewrite\/","og_site_name":"Hongkiat","article_publisher":"https:\/\/www.facebook.com\/hongkiatcom","article_published_time":"2012-07-05T13:01:08+00:00","article_modified_time":"2025-04-03T17:10:43+00:00","og_image":[{"url":"https:\/\/assets.hongkiat.com\/uploads\/wordpress-urls-rewrite\/rewrite-analyzer-screen2.jpg","type":"","width":"","height":""}],"author":"Jake Rocheleau","twitter_card":"summary_large_image","twitter_creator":"@hongkiat","twitter_site":"@hongkiat","twitter_misc":{"Written by":"Jake Rocheleau","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-url-rewrite\/#article","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-url-rewrite\/"},"author":{"name":"Jake Rocheleau","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/966b2daea15283b4145e71aa98a82c2a"},"headline":"Rewriting URLs in WordPress: Tips and Plugins","datePublished":"2012-07-05T13:01:08+00:00","dateModified":"2025-04-03T17:10:43+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-url-rewrite\/"},"wordCount":1274,"commentCount":15,"publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-url-rewrite\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/wordpress-urls-rewrite\/rewrite-analyzer-screen2.jpg","keywords":["ad-divi","WordPress Plugins","WordPress Tips"],"articleSection":["WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hongkiat.com\/blog\/wordpress-url-rewrite\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-url-rewrite\/","url":"https:\/\/www.hongkiat.com\/blog\/wordpress-url-rewrite\/","name":"Rewriting URLs in WordPress: Tips and Plugins - Hongkiat","isPartOf":{"@id":"https:\/\/www.hongkiat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-url-rewrite\/#primaryimage"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-url-rewrite\/#primaryimage"},"thumbnailUrl":"https:\/\/assets.hongkiat.com\/uploads\/wordpress-urls-rewrite\/rewrite-analyzer-screen2.jpg","datePublished":"2012-07-05T13:01:08+00:00","dateModified":"2025-04-03T17:10:43+00:00","description":"Recent updates to WordPress make it easier than ever for developers to personalize their websites. You can effortlessly modify your theme, switch out","breadcrumb":{"@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-url-rewrite\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hongkiat.com\/blog\/wordpress-url-rewrite\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-url-rewrite\/#primaryimage","url":"https:\/\/assets.hongkiat.com\/uploads\/wordpress-urls-rewrite\/rewrite-analyzer-screen2.jpg","contentUrl":"https:\/\/assets.hongkiat.com\/uploads\/wordpress-urls-rewrite\/rewrite-analyzer-screen2.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hongkiat.com\/blog\/wordpress-url-rewrite\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hongkiat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Rewriting URLs in WordPress: Tips and Plugins"}]},{"@type":"WebSite","@id":"https:\/\/www.hongkiat.com\/blog\/#website","url":"https:\/\/www.hongkiat.com\/blog\/","name":"Hongkiat","description":"Tech and Design Tips","publisher":{"@id":"https:\/\/www.hongkiat.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hongkiat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hongkiat.com\/blog\/#organization","name":"Hongkiat.com","url":"https:\/\/www.hongkiat.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","contentUrl":"https:\/\/www.hongkiat.com\/blog\/wp-content\/uploads\/hkdc-logo-rect-yoast.jpg","width":1200,"height":799,"caption":"Hongkiat.com"},"image":{"@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/hongkiatcom","https:\/\/x.com\/hongkiat","https:\/\/www.pinterest.com\/hongkiat\/"]},{"@type":"Person","@id":"https:\/\/www.hongkiat.com\/blog\/#\/schema\/person\/966b2daea15283b4145e71aa98a82c2a","name":"Jake Rocheleau","description":"Jake is a writer and designer with over 10 years experience working on the web. He writes about user experience design and cool resources for designers","sameAs":["https:\/\/www.hongkiat.com"],"url":"https:\/\/www.hongkiat.com\/blog\/author\/jake\/"}]}},"jetpack_featured_media_url":"https:\/\/","jetpack_shortlink":"https:\/\/wp.me\/p4uxU-3H3","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/14201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/comments?post=14201"}],"version-history":[{"count":3,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/14201\/revisions"}],"predecessor-version":[{"id":73533,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/posts\/14201\/revisions\/73533"}],"wp:attachment":[{"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/media?parent=14201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/categories?post=14201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/tags?post=14201"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.hongkiat.com\/blog\/wp-json\/wp\/v2\/topic?post=14201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}