Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I understand the question properly, then you need to firm up the regular expressions to only match the patterns you really want - at the moment, they're a bit too lenient for your needs.</p> <p>For example:</p> <p><code>RewriteRule ^([^/]+)$ $1.php</code></p> <p>This will match anything without a trailing slash, whereas if you wanted to restrict it to only match, say, things without a trailing slash and consisting of alphanumeric characters, then you might do this:</p> <p><code>RewriteRule ^([a-zA-Z0-9]+)$ $1.php</code></p> <p>(You could achieve the same effect for certain extensions only by using a lookahead assertion, but that complicates your regular expression. I feel it's probably saner (and easier on the mind) to think about the patterns you really want matched, and then express those up-front.)</p> <p>Likewise, your latter example:</p> <p><code>RewriteRule ^forums/([0-9]+) forums.php?category=$1 [NC]</code></p> <p>will match anything which starts with the string <strong>forums/</strong>, followed by one or more digits, whether or not there's anything after that. Adding an end anchor ($) as you have above</p> <p><code>RewriteRule ^forums/([0-9]+)$ ...</code></p> <p>will assert that the string ends after the digits.</p> <p>This relies on the fact that if <strong>mod_rewrite</strong> can't find a match, it won't attempt any rewrites, and will (in the absence of any explicit resource at that path) fall through to Apache's 404 handling, which is then up to you to override.</p>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. 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