Forum Moderators: phranque
If a user goes to [site.com...] I would like it to redirect to the following:
/index.php?u=some/string
"some/string" should only be parsed by the rule only if it does not exist on the server. So if "/some/string" was a directory on the server, the rewrite rule would not apply.
I use a multi-tier directory as an example, but it could be just a single level e.g "/some".
Is there something for a RewriteCond that can do a check to see if this is possible?
Here is my current rule(s):
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI}!-f
RewriteCond %{REQUEST_URI}!-d
RewriteCond %{REQUEST_URI}![a-z]+\.[a-z]+
RewriteRule ^(.*)$ /index.php?u=$1 [L,NC]
The only problem is, if I goto say:
[domain.com...]
It will rewrite to index.php?u=images/ even though the /images directory does exist on the server. In other words, if it is not a "filename.ext" it will be rewritten.
I was hoping there would be some sort of check like in perl with the -e flag. I tried that, and it had no effect.
Thanks!