I was using wordpress child page structure (for static/non-post pages) to create two separate page menu. It's something like this:
<?php wp_list_pages('child_of=1&sort_column=menu_order&t itle_li'); ?>
The post ID of the page with slug /pages/ is 1. Its daughter pages are /about/, /contact/ and /sitemap/
<?php wp_list_pages('child_of=2&sort_column=menu_order&t itle_li'); ?>
The post ID of the page with slug /products/ is 2. Its daughter pages are /gadget1/, /gadget2/ and /gadget3/
Now, here is my problem. The parent pages /pages/ and /products/ are not supposed to be accessible. When the site visitor tries to access any of these pages, they are to be forwarded to an error page /404/. Hence, I implemented the following in the .htaccess file.
redirect 301 /products/ http://www.domain.com/404/
Hence, when the visitor accessed the /products/, they are prompty forwarded to the /404/ page as I intended. However, whenever I access any of the daughter pages of the /products/, I obtain a "redirect loop error", something like that.
What I wanted to do is for the parent pages to redirect to /404/ but for the daughter pages to be normally accessible.
One solution I came up with is by using meta refresh and some PHP "if" function trick in the header instead of the .htaccess. However, this solution is not elegant for me. Depending on the speed of the connection, the browser will actually display the /pages/ and /products/ for some noticeable amount of time before redirecting to /404/ (the meta refresh is set to 0 seconds).