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 Restricted Page to 404
- Preventing index.php?category_name=something from redirecting
- Site redirects to wrong url when saving settings
- Redirect blog page to latest post?
- Links to an exisiting Page are now redirecting to a draft page?
- How To Only Allow Users To View Their Own Buddypress Profiles? [closed]
- htaccess redirect dynamic posts
- Redirect all pages to homepage but still allow dashboard
- Why can’t I access files / directories outside of wordpress
- Change ‘Back To Website’ link in wp-login.php
- How do I map a subdomain in wordpress to the primary domain in a multisite setup?
- htaccess rules not applied?
- Intercept the “lost password” action by first redirecting to an existing instructions page
- How to pass email values from one php page to another
- How to include error message on login
- Changing siteurl and homeurl – internal links redirect to home page?
- WooCommerce unexpected behavior [closed]
- redirect Login problems
- 301 redirection editing .htaccess doesn’t work
- Redirect custom post type from one domain to another domain
- 301-redirect directives for blogger to wordpress migration
- Some admin pages redirecting to front page on save
- Stop Redirecting to and from www
- Disable WordPress URL auto complete
- How can I disable author pages without 301 redirects?
- Redirect specific URL before other redirects take place in .htaccess?
- Redirect Main Home Page url to category URL without plugin
- W3 Cache redirects to front page when I press purge all caches
- Force 404 redirect to home?
- Is it possible to wp_redirect() to a new tab?
- Redirection on Custom page
- How to delete a post and keep its slug to refer to another post
- 301 redirect any RSS feed on level up url
- Dynamic 404 page content while still keeping 404 status code?
- simple wordpress form redirection
- Redirect to home if page doesn’t exists [duplicate]
- Redirect all links form a category to new links on new category
- My redirect URL doesn’t show any pages on my website [closed]
- Cannot install wordpress, /wp-admin/install.php, inproper redirection [closed]
- Redirect home resets (qtranslate) language
- How to redirect logged out users to specific page?
- Login redirect shows white page in firefox
- 301 all old pages to new location
- How do I share a site only to one User at the time? Please help 🥺🙌
- Re-Direct ALL Users to the Home Page IF not logged in
- Redirect to dashboard user once you click on Publish page
- Author Archive Page redirecting issue
- Understanding Redirects
- Remove part from dynamic url and redirect
- How to redirect returning users who previously logged in?
- Why https://www. SUBdomain is redirected by WP to https://MAINdomain
- Page editing in backend redirecting to 404 page not found with url /post.php
- wordpress redirect error in xampp
- Swapping current old site to new WordPress site – need to check I’m doing it right
- how redirect users to custom login page when user comment must “login to reply” is clicked?
- How to redirect a referal url to a signup page?
- Allow GET request on certain page
- .htaccess redirect for old subfolder installation to new subfolder installation and https
- How to modify the WordPress comes with redirect
- Conditional redirect on login using referring URL
- PHP Mistake – Whats wrong here?
- WordPress update 4.4.1 redirect loop
- Redirecting Issue
- Redirect user to login and then to page where they came from
- WordPress permalink still not working (error or not understood?)
- 301 redirect for wordpress permarlink
- Google PageSpeed: Avoid landing page redirects?
- Need rewrite for URL with specific string
- Redirect to 404.php from single.php
- How to Show different page URL instead of default home page URL
- How to Redirect Url to homepage?
- 404 Not Found with All Cloaking plugins
- After migration index page still redirects to old url