RewriteRule ^post/([^/]+)/([^/]+)$ /post/index.php?$1=$2 [NC]

which does how it is designed to do: have a URL like post/color/black and turn that into post/index.php?color=black.

However , this affects such things as the stylesheet (situated at publish/styles/style.css), along with other files that actually exist.

So now you ask ,: basically be aware of exact $_GET secrets that should be converted, how do i limit the above mentioned RewriteRule to simply do its miracle for individuals specific secrets, but leave anything else untouched?


You should use:



^post/([^/]+)/((?!bad keywords)[^/]+)$

You may either:

  • Make use of the -f flag to exclude really existing assets in the rewrite process with the addition of the next RewriteRules:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
  • Or store your static assets outdoors /post - this is best since you can exclude the potential of collisions with 100% certainty, and also you save Apache from searching the file up (that is only relevant with many different traffic though).