title: Htaccess: Redirect and remove paths after
body: <p>I'm trying to block access to our <code>/admin.php</code> page and anything related to <code>admin.php</code> (this isn't a folder in our file system, we're using a central <code>.htaccess</code> in root).</p>
  
  <p>I'm able to do this with the following:</p>
  
  <pre><code>RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123$
  RewriteCond %{THE_REQUEST} ^(.*)?admin\.php(.*)$ [NC]
  RewriteRule ^(.*)$ https://oursite.com/$1 [R=301,L]
  </code></pre>
  
  <p>This works, however, anything after <code>/admin.php</code> sticks in the URL after redirection and goes to 404 page. I just want it to redirect to home.</p>
  
  <p>For example, this URL <code>https://example.com/admin.php?/cp/login&amp;return=</code> redirects to <code>https://example.com/?/cp/login&amp;return=</code>.</p>
  
  <p>It just strips the admin part. I need it to strip everything.</p>