{"id":26160,"date":"2022-10-24T08:42:40","date_gmt":"2022-10-24T12:42:40","guid":{"rendered":"https:\/\/plumrocket.com\/docs\/?p=26160"},"modified":"2022-10-24T08:44:02","modified_gmt":"2022-10-24T12:44:02","slug":"how-to-use-url-patterns-in-plumrocket-extensions","status":"publish","type":"post","link":"https:\/\/plumrocket.com\/docs\/magento-base\/v1\/userguides\/url-patterns","title":{"rendered":"How to Use URL Patterns in Plumrocket Extensions"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">We have developed URL patterns to easily adjust the extension&#8217;s logic to the specific category or set of pages. We use them in many extensions, such as AMP, Popup Login, Cookie Consent, and others to enable or disable some functionality only on specific pages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Please note that this documentation applies to Magento 2 Base extension v2.9.0 and later.<\/p>\n\n\n\n<div class=\"wp-block-group pr-notice pr-notice-warning\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p class=\"pr-notice-title wp-block-paragraph\">Important information:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Only the URL path is taken into account when checking the pattern. For example, the following URL <code class=\"\" data-line=\"\">https:\/\/example.com\/category\/product.html?v=1#reviews<\/code> will be truncated to <code class=\"\" data-line=\"\">\/category\/product.html<\/code>.<\/p>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group pr-notice pr-notice-info\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p class=\"pr-notice-title wp-block-paragraph\">Note for developers:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can use Regular Expressions instead of the provided URL patterns by adding the <code class=\"\" data-line=\"\">regex::<\/code> prefix to the pattern. For example, <code class=\"\" data-line=\"\">regex::#\\\/category\\\/.*?#<\/code> or <code class=\"\" data-line=\"\">regex::~[\/]category[\/]?~<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n<\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-url-pattern-specification\">URL Pattern Specification<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use the following special characters in URL patterns:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code class=\"\" data-line=\"\">*<\/code> &#8211; matches 0 or more of the preceding characters (equivalent to the <code class=\"\" data-line=\"\">.*<\/code> regular expression)<\/li><li><code class=\"\" data-line=\"\">+<\/code> &#8211; matches 1 or more of the preceding characters (equivalent to the <code class=\"\" data-line=\"\">.+<\/code> regular expression)<\/li><li><code class=\"\" data-line=\"\">\\<\/code> &#8211; makes the character non-special, for example, <code class=\"\" data-line=\"\">\\+<\/code> will be considered as <code class=\"\" data-line=\"\">+<\/code>.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If your patterns don&#8217;t start with <code class=\"\" data-line=\"\">\/<\/code>, <code class=\"\" data-line=\"\">*<\/code>, or <em><code class=\"\" data-line=\"\">+<\/code><\/em> characters, a slash (<code class=\"\" data-line=\"\">\/<\/code>) will be automatically added to the beginning to reduce the number of mistakes. Therefore, <code class=\"\" data-line=\"\">\/category\/*<\/code> and <code class=\"\" data-line=\"\">category\/*<\/code> patterns are considered the same. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-url-pattern-examples\">URL Pattern Examples<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example 1.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <code class=\"\" data-line=\"\">\/category\/*<\/code> pattern matches the following URLs:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>https:\/\/example.com\/category\/product.html<\/li><li>https:\/\/example.com\/category\/<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">However, it does not match the following URLs: <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>https:\/\/example.com\/category (the end slash is missing)<\/li><li>https:\/\/example.com\/parent-category\/category\/product.html (there are extra characters before <code class=\"\" data-line=\"\">\/category\/<\/code>)<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example 2.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <code class=\"\" data-line=\"\">\/category\/+<\/code> pattern matches the following URL:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>https:\/\/example.com\/category\/product.html<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">However, it does not match the following URL:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>https:\/\/example.com\/category\/ (must be at least one character after <code class=\"\" data-line=\"\">\/category\/<\/code>)<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>We have developed URL patterns to easily adjust the extension&#8217;s logic to the specific category or set of pages. We use them in many extensions, such as AMP, Popup Login, Cookie Consent, and others to enable or disable some functionality only on specific pages. Please note that this documentation applies to Magento 2 Base extension &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/plumrocket.com\/docs\/magento-base\/v1\/userguides\/url-patterns\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Use URL Patterns in Plumrocket Extensions&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[134],"tags":[],"class_list":["post-26160","post","type-post","status-publish","format-standard","hentry","category-magento-base-v1","entry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Use URL Patterns in Plumrocket Extensions - Plumrocket Documentation<\/title>\n<meta name=\"description\" content=\"We have developed URL patterns to easily adjust the extension&#039;s logic to the specific category or set of pages. We use them in many extensions, such as\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/plumrocket.com\/docs\/magento-base\/v1\/userguides\/url-patterns\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Use URL Patterns in Plumrocket Extensions - Plumrocket Documentation\" \/>\n<meta property=\"og:description\" content=\"We have developed URL patterns to easily adjust the extension&#039;s logic to the specific category or set of pages. We use them in many extensions, such as\" \/>\n<meta property=\"og:url\" content=\"https:\/\/plumrocket.com\/docs\/magento-base\/v1\/userguides\/url-patterns\" \/>\n<meta property=\"og:site_name\" content=\"Plumrocket Documentation\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-24T12:42:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-10-24T12:44:02+00:00\" \/>\n<meta name=\"author\" content=\"Plumrocket\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Plumrocket\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Use URL Patterns in Plumrocket Extensions - Plumrocket Documentation","description":"We have developed URL patterns to easily adjust the extension's logic to the specific category or set of pages. We use them in many extensions, such as","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:\/\/plumrocket.com\/docs\/magento-base\/v1\/userguides\/url-patterns","og_locale":"en_US","og_type":"article","og_title":"How to Use URL Patterns in Plumrocket Extensions - Plumrocket Documentation","og_description":"We have developed URL patterns to easily adjust the extension's logic to the specific category or set of pages. We use them in many extensions, such as","og_url":"https:\/\/plumrocket.com\/docs\/magento-base\/v1\/userguides\/url-patterns","og_site_name":"Plumrocket Documentation","article_published_time":"2022-10-24T12:42:40+00:00","article_modified_time":"2022-10-24T12:44:02+00:00","author":"Plumrocket","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Plumrocket","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/plumrocket.com\/docs\/magento-base\/v1\/userguides\/url-patterns#article","isPartOf":{"@id":"https:\/\/plumrocket.com\/docs\/magento-base\/v1\/userguides\/url-patterns"},"author":{"name":"Plumrocket","@id":"https:\/\/plumrocket.com\/docs\/#\/schema\/person\/c96fccdb89342ae6804272265723eca8"},"headline":"How to Use URL Patterns in Plumrocket Extensions","datePublished":"2022-10-24T12:42:40+00:00","dateModified":"2022-10-24T12:44:02+00:00","mainEntityOfPage":{"@id":"https:\/\/plumrocket.com\/docs\/magento-base\/v1\/userguides\/url-patterns"},"wordCount":273,"articleSection":["v1"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/plumrocket.com\/docs\/magento-base\/v1\/userguides\/url-patterns","url":"https:\/\/plumrocket.com\/docs\/magento-base\/v1\/userguides\/url-patterns","name":"How to Use URL Patterns in Plumrocket Extensions - Plumrocket Documentation","isPartOf":{"@id":"https:\/\/plumrocket.com\/docs\/#website"},"datePublished":"2022-10-24T12:42:40+00:00","dateModified":"2022-10-24T12:44:02+00:00","author":{"@id":"https:\/\/plumrocket.com\/docs\/#\/schema\/person\/c96fccdb89342ae6804272265723eca8"},"description":"We have developed URL patterns to easily adjust the extension's logic to the specific category or set of pages. We use them in many extensions, such as","breadcrumb":{"@id":"https:\/\/plumrocket.com\/docs\/magento-base\/v1\/userguides\/url-patterns#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/plumrocket.com\/docs\/magento-base\/v1\/userguides\/url-patterns"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/plumrocket.com\/docs\/magento-base\/v1\/userguides\/url-patterns#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Docs","item":"https:\/\/plumrocket.com\/docs"},{"@type":"ListItem","position":2,"name":"Magento 2 Extensions","item":"https:\/\/plumrocket.com\/docs\/magento-extensions"},{"@type":"ListItem","position":3,"name":"Base","item":"https:\/\/plumrocket.com\/docs\/magento-base"},{"@type":"ListItem","position":4,"name":"v1","item":"https:\/\/plumrocket.com\/docs\/magento-base\/v1"},{"@type":"ListItem","position":5,"name":"How to Use URL Patterns in Plumrocket Extensions"}]},{"@type":"WebSite","@id":"https:\/\/plumrocket.com\/docs\/#website","url":"https:\/\/plumrocket.com\/docs\/","name":"Plumrocket Documentation","description":"Extensions docs, troubleshootings etc.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/plumrocket.com\/docs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/plumrocket.com\/docs\/#\/schema\/person\/c96fccdb89342ae6804272265723eca8","name":"Plumrocket","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/30d7e8cb4567485b56880a1658849a1252ac12806e8f95b3be71e986bf5eabee?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/30d7e8cb4567485b56880a1658849a1252ac12806e8f95b3be71e986bf5eabee?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/30d7e8cb4567485b56880a1658849a1252ac12806e8f95b3be71e986bf5eabee?s=96&d=mm&r=g","caption":"Plumrocket"}}]}},"_links":{"self":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/26160","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/comments?post=26160"}],"version-history":[{"count":10,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/26160\/revisions"}],"predecessor-version":[{"id":26170,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/26160\/revisions\/26170"}],"wp:attachment":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/media?parent=26160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/categories?post=26160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/tags?post=26160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}