Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The rewrite engine loops, so you need to pasthrough successful rewrites before finally rewriting to error.php. Maybe something like:</p> <pre><code>RewriteCond %{REQUEST_URI} !^/$ RewriteCond %{REQUEST_URI} !^/(special|ready|building|feedback|show_property)\.php RewriteCond %{REQUEST_URI} !^/((images|upload)/.+|style.css)$ RewriteRule ^ error.php?code=404 [QSA,L,R=404] </code></pre> <p>Each condition makes sure the URI isn't one of the ones your other rules have rewritten to.</p> <p>The <code>R=404</code> will redirect to the error.php page as a "404 Not Found".</p> <hr> <blockquote> <p>Unfortunatelly, it didn't work - it allows access to all files on the server (presumably because all conditions need to be satisfied). I tried an alternate solution:</p> </blockquote> <p>Something else must be slipping through, eventhough when I tested your rules plus these at the end in a blank htaccess file, it seems to work. Something else you can try which is a little less nice but since you don't actually redirect the browser anywhere, it would be hidden from clients.</p> <p>You have a <code>QSA</code> flag at the end of all your rules, you could add a unique param to the query string after you've applied a rule, then just check against that. Example:</p> <pre><code>RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^((images|upload)/.+|style.css)$ $1?_ok [L,QSA] </code></pre> <p>then at the end:</p> <pre><code>RewriteCond %{QUERY_STRING} !_ok RewriteRule ^ error.php?code=404&amp;_ok [QSA,L,R=404] </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload