{"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>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>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\">\n<p class=\"pr-notice-title\">Important information:<\/p>\n\n\n\n<p>Only the URL path is taken into account when checking the pattern. For example, the following URL <code>https:\/\/example.com\/category\/product.html?v=1#reviews<\/code> will be truncated to <code>\/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\">\n<p class=\"pr-notice-title\">Note for developers:<\/p>\n\n\n\n<p>You can use Regular Expressions instead of the provided URL patterns by adding the <code>regex::<\/code> prefix to the pattern. For example, <code>regex::#\\\/category\\\/.*?#<\/code> or <code>regex::~[\/]category[\/]?~<\/code>.<\/p>\n\n\n\n<p><\/p>\n<\/div><\/div>\n\n\n\n<h2 id=\"h-url-pattern-specification\">URL Pattern Specification<\/h2>\n\n\n\n<p>Use the following special characters in URL patterns:<\/p>\n\n\n\n<ul><li><code>*<\/code> &#8211; matches 0 or more of the preceding characters (equivalent to the <code>.*<\/code> regular expression)<\/li><li><code>+<\/code> &#8211; matches 1 or more of the preceding characters (equivalent to the <code>.+<\/code> regular expression)<\/li><li><code>\\<\/code> &#8211; makes the character non-special, for example, <code>\\+<\/code> will be considered as <code>+<\/code>.<\/li><\/ul>\n\n\n\n<p>If your patterns don&#8217;t start with <code>\/<\/code>, <code>*<\/code>, or <em><code>+<\/code><\/em> characters, a slash (<code>\/<\/code>) will be automatically added to the beginning to reduce the number of mistakes. Therefore, <code>\/category\/*<\/code> and <code>category\/*<\/code> patterns are considered the same. <\/p>\n\n\n\n<h2 id=\"h-url-pattern-examples\">URL Pattern Examples<\/h2>\n\n\n\n<p><strong>Example 1.<\/strong><\/p>\n\n\n\n<p>The <code>\/category\/*<\/code> pattern matches the following URLs:<\/p>\n\n\n\n<ul><li>https:\/\/example.com\/category\/product.html<\/li><li>https:\/\/example.com\/category\/<\/li><\/ul>\n\n\n\n<p>However, it does not match the following URLs: <\/p>\n\n\n\n<ul><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>\/category\/<\/code>)<\/li><\/ul>\n\n\n\n<p><strong>Example 2.<\/strong><\/p>\n\n\n\n<p>The <code>\/category\/+<\/code> pattern matches the following URL:<\/p>\n\n\n\n<ul><li>https:\/\/example.com\/category\/product.html<\/li><\/ul>\n\n\n\n<p>However, it does not match the following URL:<\/p>\n\n\n\n<ul><li>https:\/\/example.com\/category\/ (must be at least one character after <code>\/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,"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[134],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v17.2 (Yoast SEO v17.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\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\" \/>\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=\"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 Premium 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","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","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Plumrocket","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@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":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/plumrocket.com\/docs\/magento-base\/v1\/userguides\/url-patterns#webpage","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":"Person","@id":"https:\/\/plumrocket.com\/docs\/#\/schema\/person\/c96fccdb89342ae6804272265723eca8","name":"Plumrocket","image":{"@type":"ImageObject","@id":"https:\/\/plumrocket.com\/docs\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/10c44aa45aab391250913d982e552e53?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/10c44aa45aab391250913d982e552e53?s=96&d=mm&r=g","caption":"Plumrocket"}}]}},"_links":{"self":[{"href":"https:\/\/plumrocket.com\/docs\/wp-json\/wp\/v2\/posts\/26160"}],"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}]}}