Are you failing to supply the trailing slash on the pre-rewrite URL? That regex won’t match without it.
Since your /parent-page and /parent-page/child-page are WordPress pages you shouldn’t be using .htacceess for this at all, because it would prevent WordPress from loading for those URLs. Instead you should be hooking to query_vars
so WordPress won’t strip your new variable from the querystring and to rewrite_rules_array
to handle the actual rewrite.
Related Posts:
- How to create custom 401, 403 and 500 error pages?
- PHP – redirect https to http and www to non-www
- Bypass .htaccess when using download_url
- How can I run a .php file located in my site’s root folder?
- Fix 403 error on WordPress multisite network using subdomains
- How to redirect all 404 in a WordPress subdirectory to the index.php of subdirectory?
- How to run multiple websites from single WordPress setup
- Using PHP in a Stylesheet (possibly a “.htaccess” problem?)
- How to override .htaccess with new rules without ftp or edit it manual
- WordPress-site can be reached on x.x.x.x/index.php – but not directly on the IP without index.php
- Change the actual (or viewable) WordPress directory structure
- Add htaccess rules with insert_with_markers at beginning of htaccess
- Cannot get media type from ‘x-mapp-php5’
- How to rewrite URL with PHP variables with htaccess to a normal looking URL?
- How to change home or site url using action hooks or filter?
- Apache Fallback instead of add_rewrite_rule
- 3 blogs same installation, without WP MU
- Two Different Links for Same Product – WooCommerce [closed]
- Was told to change the .htacess file form .html to .php so this would work properly
- How to change redirection route to a php page for making it only accessible by logged-in members?
- how to combine wordpress htaccess on my root domain + php on subfolder
- subdirectory index.php is not working
- custom url rewrite for wordpress
- Loading index.php contents which located outside blog folder for post single page
- WP & Server Speed [Teacher Question]
- WordPress add_rewrite_rules for custom URLs ending in .html
- Troll the hackers by redirecting them
- Seo Friendly Filter URLs
- How to allow download url redirection only if user logged in WordPress site?
- How to disable all logins except Network login in WordPress Multi site?
- Removing files programmatically
- Is it possible to restrict files from your wordpress uploads (not logged-in users or guest)?
- Simple seo-friendly custom $_GET url rewrite with htaccess
- How to make Subdomain work for product_tag?
- How to serve WordPress folder over subdomain?
- Pages from admin dasboard missing after site migration
- Rewrite rule not working, but only when parameter is text
- Internal Server Errors – Moving working multi-site install to my localhost
- Deny php execution in /wp-includes – using .htaccess in /wp-includes VS root folder
- How come there is no error if I upgrade WordPress core after locking .htaccess permissions to 644?
- How to block access to a folder inside of wp-content for non logged in users?
- WordPress Redirect / Add_Rewrite_Rule – Non Index.php Page
- Upload images from one server to an other in wordpress
- Problem with ajax request and directory structure after site migration
- How can I add “.html” to the end of a single URL on a WordPress website?
- Resource 404 error on multisite subdirectory install
- redirect 301 with special character like WIX site “#!”
- 301 redirect from webpage to wordpress page in the same root
- Rewrite /keyword1+keyword2.html to search page | .htaccess
- Redirect homepage /page/1/ to /blog/page/1/
- Enabling XSendFile causes 404 for images on WordPress Multisite / Network
- Why I can download any file except PHP files from a URL but I can download any from another site?
- 3 domains, 1 wordpress install, redirecting and changing domains on live site
- How to use multiple 404 Error Pages in WordPress
- Increase Upload Size with htaccess | MAMP
- How to find cause of PHP notices with no stack trace?
- How to paginate a list of custom taxonomy terms?
- reason of splitting theme files to multiple files
- wordpress separate registration for different roles
- Problem with Woocommerce REST API Authentication
- How to get custom image size for image uploaded in Customizer
- How to Fetch values from WP database based on selected option value by onchange using PHP?
- How to create a custom category of wordpress admin
- WordPress child theme fails to override parent navigation menu in /inc/structure/header.php
- Customizer: Output default value in Customizer CSS
- PHP Warning: chmod(): Operation not permitted in class-wp-filesystem-direct.php on line 173
- WordPress asks you for your FTP details if you want to run Automatic Updates/Upgrade Plugins
- Trying do build a contact form
- How to integrate noimage picture in this code
- get comment data using comment id
- WordPress transient not working with WP Engine
- Basic wpdb update question
- Only show size attributes in product box woocommerce when available
- Can I set up a hover animation in CSS depending on a PHP conditional?
- WordPress upload file size error even after raising php limits
- Function for simple math doesn’t work what am I doing wrong? [closed]
- Trying to run website a php file is blank
- Create condition for Author bio Social Links
- Redirecting visitor from foreign domain with WP content as referrer
- wp_query – Exclude the first thumbnail from lazy loading on archives
- Change lost password url to a mailto URL in WordPress
- Exclude category from woocommerce product category list
- How to let mobile navigation menu close when link is clicked?
- How to transfer variables from one function to another [closed]
- Plugin Modification Change Functionality For Logged User Only
- How can I output the slug of a comment author?
- Modify category archive page loop on functions.php
- How to display html code on homepage
- two wordpress sites, two themes, one database, same content
- Check if values exists DB
- Trying to exclude posts from a category on the home page
- Php conditional help needed
- Adapting a php array to WordPress
- Different layout on search page depending on category post
- Issues trying to add a href statment with PHP into a PHP Echo Statement [closed]
- Help with if/else loop [closed]
- WordPress directories not writable after PHP version upgrade
- How do I unset category from a product in wordpress by code
- Load style and script for custom post type metabox
- Permissions error when I use my plugin to delete comments in the front-end