All internal rewrite rules must point to index.php. This isn’t a theme file, it’s the main bootstrap file in the root of your WordPress install. So, your rule should look like:
add_action( 'init', 'wpse26388_rewrites_init' );
function wpse26388_rewrites_init(){
add_rewrite_rule(
'properties/([0-9]+)/?$',
'index.php?pagename=single-deal&property_id=$matches[1]',
'top'
);
}
You can then assign the deal.php template to your single-deal page in the admin interface, or you can use the page_template filter if you want to apply conditional template loading, like for example only if your property_id query var is set.
Related Posts:
- Old blog/ and blog/feed/ URLs not working after moving blog to top-level via .htaccess
- add_rewrite_rule to pass entire path as a single parameter
- RedirectMatch and Redirect interfering with each other
- url keeps redirecting to a page
- Why specific file directory fails to redirect but its parent folder succeeds?
- Redirect home to another page with htaccess
- Adding rewrite rule dynamically for search results redirecting to 404 URL
- Redirections and rewrites to subdomain
- Image URLs not redirecting properly
- How do I determine what is causing a redirect for a given page?
- How to pass a message using template_redirect
- !is_admin() condition turns true in admin pages
- Why does the $_GET parameter ?search forward the front-page to the archive/blog page
- Create a permalink to a pdf?
- Page get parameter doesn’t work with is_single() function
- Redirect old query string URLs to new add_rewrite_rule URL
- HTTPS to HTTP rewrite rules not working as expected
- Trying to re-direct users to specific page based on an ACF variable
- Is it possible to change redirect template through a shortcode?
- ErrorDocument 410 gives me back a 302 header
- Redirect *.php to path using web.config file
- How to create multiple Rewrite-Rule for various site in single htaccess?
- Internal redirect from page to category
- Cannot get 301 redirection in htaccess to work (either Redirect or Rewrite)
- htaccess and redirect to new url using regex
- Rewrite rule to redirect to a particular filename.php
- Redirect to a subdirectory frontpage using without using a WP plugin- what files to edit, and how?
- Redirect to dashboard after login
- Make a video post redirect to next post after completion
- Site redirects to wrong url when saving settings
- WordPress Redirect based on the prescence of a cookie
- Remove lost password form and URL
- How To Only Allow Users To View Their Own Buddypress Profiles? [closed]
- htaccess redirect dynamic posts
- Menu links only using http after enabling https, unable to redirect http links
- Redirect all pages to homepage but still allow dashboard
- some url does not redirect from http to https
- Why can’t I access files / directories outside of wordpress
- Redirect the non-www version of the site to the www
- htaccess rules not applied?
- Intercept the “lost password” action by first redirecting to an existing instructions page
- How to redirect after login getting a variable from url (for example with the language)
- How to set 301 redirection after moving WordPress blog?
- How to use a custom domain?
- Changing siteurl and homeurl – internal links redirect to home page?
- redirect Login problems
- 301 redirection editing .htaccess doesn’t work
- Redirect custom post type from one domain to another domain
- 301 redirect instead of 404 when URL is a prefix of a post or page name?
- 301-redirect directives for blogger to wordpress migration
- Some admin pages redirecting to front page on save
- Stop Redirecting to and from www
- URL rewriting with custom user meta “/%shop_name%/gallery/%gallery%”
- .htaccess 301 redirect conflict with plugin “WordPress Https”
- Problem in disabling canonical 301 redirect
- Prevent users from going to wordpress profile after login
- How to redirect just one or two blog posts correctly?
- Keep subcategory grandson in slug
- How to redirect only 404 pages with htaccess in WordPress
- How to redirect the frontend of a WordPress site (only)?
- My site is being redirected to itself
- Permalinks do not include www subdomain
- Front page is being directed to an unknown site
- Domain redirect to wp-admin/setup-config.php file
- After retrive password, redirect to index page
- Change Category Slug Redirection
- WordPress redirect to new domain name
- Blog post is redirecting to home page
- wp_redirect is only working in Chrome Network, page is not redirecting
- Bulk redirect all post
- Disable redirect to homepage after successful Login, Stay on Current Page
- WordPress no permission redirection to a popup
- How force WordPress redirect to current custom page after login
- How to remove redirection
- Site using static homepage, redirects (301) and removes pluses from query string
- Unusual Apache2 Error Causing WordPress Redirect Error?
- Redirect error after updating WordPress to 5.4.2
- 301 Redirect Loop www to non-www – Nginx + Apache2
- how to redirect 404 to attachment.php?
- 301 Redirect in WordPress not working in htaccess
- Disable WordPress URL auto Redirect
- redirect to https://my-site/wp-admin/ instead of https://my-site/wordpress/wp-admin/ after options updating
- Redirect after login when WordPress in subdirectory
- I get “too many redirects” problem when migrating localhost site
- Redirect after Permalink change – What regex do I use?
- Configure WordPress to listen on a port other than 80
- Do I need to keep the original page when 301 redirecting to a new one?
- I’ve move my site but URL still goes to the old site
- Any way to make Apache’s internal redirect work?
- Redirect attachment URL
- Conditional redirection with logout
- Logging back into WordPress after logging out and having issues with ‘loggedout=true’ in redirect URL
- WordPress subfolders htaccess bypassing the root htaccess RewriteRule
- Rewrite Rule working different than expected
- Redirect to Homepage if URL contains string
- How to redirect to a page after submitting form data?
- How to setup an automatic redirect for when there has been a critical error on the site?
- How to force HTTP and stop SSL completey on WordPress website
- WordPress keeps redirecting to root site after saving any setting
- openlitespeed rewrite rules conversion from apache