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 domain and subdomain to rewrited rule depending on $_SERVER[‘REMOTE_ADDR’]
- 301 Redirect via rewrite_rules_array (not .HTACCESS)
- PHP header(Location: …): Force URL change in address bar
- What does HTTP/1.1 302 mean exactly?
- php refresh current page?
- How to create custom URL routes?
- How to force a 404 on WordPress
- Disable front end to use as CMS only?
- Redirect Restricted Page to 404
- How to redirect non-logged in users to a specific page?
- How to prevent automatic redirection of 404 errors and “incorrect” URLs?
- How do I skip wordpress’s 404 handling and redirect all 404 errors for static files to 404.html?
- Disable WordPress URL auto complete
- Host the wp-admin on another domain?
- Redirect user to original url after login?
- When I change slug, will WordPress create redirect from the old URL?
- WordPress localhost site redirect to live site
- WordPress redirecting connections on port 8080 to 80
- WordPress Redirect All HTTP requests to HTTPS via .htaccess
- wp_redirect() function is not working
- Redirect entire website to a single page
- My wordpress multisite homepage redirects to signup page
- Logout redirect to home page
- Disable ONLY URL auto complete, not the whole canonical URL system
- Redirect Localhost wordpress site to dashboard
- Redirect page URL to home URL without using a plugin
- Why is WordPress redirecting from http to https on a local environment?
- Login redirect to previous page
- How to prevent redirect to ‘About’ after core upgrade?
- 301 redirect instead of 404 when URL is a prefix of a post or page name?
- Why is wp_redirect() preferable to a standard PHP header redirect?
- How do I programmatically generate a 404?
- Redirect to referring page after logging in
- User redirect to destination URL after login
- Prevent access to single post types
- check first time login only
- How to change the default logout link on WordPress Admin
- Stop WordPress from “guessing” redirects for nonexistent URLs
- WordPress install enters an infinite loop
- How to redirect a sucessful registration to a page template?
- add_rewrite_rule: $matches var not replaced by captured value
- How to configure nginx to redirect requests to the uploads directory to the production server?
- WordPress HTTPS redirect loop
- Why am I getting a 301 on a existing post?
- Redirect to dashboard after login
- Make a video post redirect to next post after completion
- Non-WordPress page in subdirectory under WordPress page
- Preventing index.php?category_name=something from redirecting
- Force HTTPS using .htaccess – stuck in redirect loop
- How to redirect after login, the working way?
- Keeps on redirecting on my development copy
- Password change when the user login first time
- Custom login form redirect to external site
- Redirecting WordPress /.htaccess / HSTS / SSL
- 301 redirect not working through .htaccess
- handling login/logout redirects
- How to change default page slug?
- Clarification on auth_redirect()
- stop redirection on /wp-admin call to /wp-login
- WordPress multisite,several different languages,page redirect?
- Site redirects to wrong url when saving settings
- How to redirect all requests to wp-login.php?
- Implementing global redirection (automatic redirect for all pages who had their slug changed)
- Correct way to hide pseudo pages from being shown?
- Redirect blog page to latest post?
- Redirect to custom url when registration fails?
- Why does WordPress automatically redirect URLs with the parameter “name=” to a different page?
- prevent/block direct access to a thank you page
- Redirect After Delete User in Backend
- Exclude a path from WordPress using .htaccess redirects (Apache)
- Restrict Access to wp-login.php
- How to setup 301 redirects for multiple query string URLs?
- How do I add a add_rewrite_rule without it redirecting?