I just did a test and it seems like the rewrite rules imply ^ if you do not specify it. In my test I found:
rule 'foo' matched url 'foo'
rule '^foo' matched url 'foo'
rule 'foo' did not match url 'afoo'
rule '^foo' did not much url 'afoo'
rule '.*foo' matched url 'afoo'
So i had to explicitly add some matching regex at the start for it to match extra characters at the start.
‘foo’ did not match ‘afoo’
Personally, I like to be specific, so I think you’re right it makes sense to make your regex '^sitemap\.xml$'
because that’s what it will do.
Related Posts:
- Rewrite rule to load images from production does nothing
- Rewriting “pretty” blog category URL with htaccess / add_rewrite_rule() causes 404 page
- How do I make WordPress revise an .htaccess file a certain way?
- Pretty URL via Rewrite
- Can’t get pretty permalinks to work without index.php
- How to create custom URL routes?
- Masking wp-content/themes/name/images to just images directory using htaccess
- How to add custom rewrite rule to .htaccess?
- How to change default page slug?
- SEO Friendly URLs for my plugin categories
- Mod_rewrite delete parameter in 301 Redirect
- Custom rewrite rules are sending everything to index.php
- WordPress keeps writing rewrite rules to .htaccess
- WordPress Rewrite
- Dynamic URL, not a physical page within the database
- Need to make a php file inside theme accessible via url
- Evaluating a external rewrite rule before internal wordpress rewrite rule
- Custom rewrite rule
- hard flush_rewrite_rules() not regenerating .htaccess
- Map alt domain to specific section of website w/o MU
- Rewrite Rules Are Redirecting and Not Passing VARs
- Adding rewrite rules directly to .htaccess file
- Custom rewrite not working
- Url Rewriting a dynamic wordpress page
- My WP_options db rewrite_rules Does Not Work
- Disable Pagination on Pages
- WP is ignoring .htaccess rewritten URL
- a one-off rewrite rule
- .htaccess rewrite
- Rewrite wp-login.php URLS to static pages?
- Change htaccess to redirect to index.php in subfolder
- Rewrite custom post type URL parameters
- How to remove wordpress directory slash
- Changed pagination URLS to use p= instead of paged=
- Rewrite URLs – Custom Post Type – Post Slug, Taxonamy Slug
- URL Rewriting for PHP script on an image URL
- Change pagination url format
- Custom Rewrite rule to captured post (rewrite rule to rewrite rule)
- Map secondary domain to other’s virtual subfolder
- URL rewriting with custom user meta “/%shop_name%/gallery/%gallery%”
- WordPress keeps writing rewrite rules to .htaccess
- Customise particular RSS permalink
- RSS feed rewrite matching wrong rule
- Localize URL bases
- How can I create custom URL routes?
- Rewrite specific action url
- force www rewrite if wordpress put in a folder
- Rewrite rule that wp-login.php?action=register is left alone
- How to change an existing wordpress page rewrite rule?
- ModRewrite not working properly
- Migration from old CMS to WordPress 301 redirection rules?
- Custom Rewrite for Profiles
- Additional .htaccess rules based on wp page
- What is the proper way to use add_rewrite_rule to remove the (question mark)?
- help with rewrite_tag and rewrite_rule for custom page GET variables [duplicate]
- How to redirect a virtual page (e.g. /blog) to the home page?
- Add rewrite endpoint and .htaccess
- Rewrite Page Parameters
- WP-Include rewrite directory
- Is it possible to use the same slug structure for a taxonomy and for some pages?
- URL rewriting problem
- htaccess – Redirect to subfolder without changing browser URL
- Generic htaccess redirect www to non-www
- How do you create a “virtual” page in WordPress
- remove “index.php” from permalinks
- Change the “page” slug in pagination
- Understanding add_rewrite_rule
- web.config conflict on IIS
- Rewrite rules not working in WordPress
- Dynamic Endpoints
- Passing parameters to a custom page template using clean urls
- How do I remove a rewrite rule?
- Problem with add_rewrite_rule and pagination (paged and page query_vars)
- Use subdomain for certain urls
- generate_rewrite_rules (action) vs add_rewrite_rule (function): which one is preferred?
- add_rewrite_rule: $matches var not replaced by captured value
- Clash of the rewrites
- How-to add rewrite rules to point the uploads folder to a subdomain
- Rewrite Rules for Multiple (more than 2) Taxonomies
- add_rewrite_rule not loading correct page nor getting variables
- Preserving $_GET parameter while using custom Rewrite Rule
- Disable wordpress pagination URL rewrite for specific page
- How to use Post Custom Metadata in Post Titles and Post Permalinks
- Rewrite url for custom post type
- add_query_vars and add_rewrite_rules
- How to remove “admin.php?page=” from wp-admin using .htaccess?
- rewrite_rule() not preserving the query string
- Need help with rewrite_rules_array
- How do I add a add_rewrite_rule without it redirecting?
- How to map permalinks with accented letters to sanitized slugs?
- Taxonomy rewrite question
- add_rewrite_rule not working for page var
- How do I remove a word from a url in WordPress using .htaccess?
- Why does wordpress still strip my query var?
- When to call `add_rewrite_rule` for safety
- Hijacking the URL for filtering
- Rewrite rules in .htaccess get overwritten?
- WordPress URL rewrite regex
- Getting add_rewrite_rule and add_rewrite_tag to work
- Blog installed in subdirectory but need to create pages in root. How to use permalinks?