Php – Mod_Rewrite – Skip rule if .php extenstion exists


I cannot figure out a way to skip the next rule if a .php extension exists in the url

Here is what I'm currently using

RewriteCond %{REQUEST_URI} !\.php
RewriteCond %{REQUEST_URI} \/([0-9a-z]*)$ [NC]
RewriteRule ^(.*) index.php?un=$1 [L]

Best Solution

Your question is a little ambiguous, but the following may be helpful. It adds a condition to the next rewrite rule, so that it only is evaluated if .php does not occur in the request URI.

RewriteCond %{REQUEST_URI} !\.php
RewriteRule  # Your rewrite rule here