title: .htaccess redirect all subpages to parent page
body: <p>What I am trying to achieve is to redirect pages like this:</p>
  
  <p><code>http://mydomain.com/parent/child_no1</code><br>
  <code>http://mydomain.com/parent/child_no2</code><br>
  <code>http://mydomain.com/parent/child_no3</code><br></p>
  
  <p>No matter what comes after /parent/ I want it to redirect to /parent/index.php</p>
  
  <p>I've looked into it on stackoverflow but there lots of similar topics with no answer. So I try to work on it myself.</p>
  
  <p>Here is what it didn't work:</p>
  
  <pre><code>RewriteRule ^/parent/.*$ http://mydomain.com/parent/ [R=301,L]
  
  RewriteRule ^/parent/(.*)$ http://mydomain.com/parent/ [R=301,L]
  
  RewriteRule ^parent(/(.*))$ http://mydomain.com/parent/ [R=301,L,NC]
  
  RedirectMatch 301 ^/parent/.*$ http://mydomain.com/parent/
  </code></pre>
  
  <p>The problem is that accessing <code>http://mydomain.com/parent/</code> also gets redirected which causes a redirection loop.</p>
  
  <p>Does anyone have a solution for this?</p>