mod rewrite - mod_rewrite precedence -
Assume that I want to support twitter like URL where: twitter.com/username
Code> twitter.com/user_name.php?user=username
I have the following
revised rule ^ (. *) $ User_name.php? User = $ 1
And it works fine but the problem is that everything including twitter.com/index.php
, that means user_name. Php
will be redirected to the exception or predecessor so that the "real file" is not rewritten? I tried to add a clear rule for index.php before and after that, but it does not seem to be effective.
You must add RewriteCond
for it
< Code> RewriteCond% {REQUEST_URI}! -f [or] RewriteCond% {REQUEST_URI} for # existing files! -d # RewriteRule for existing directory ^ (. *) $ User_name.php? User = $ 1
Comments
Post a Comment