Possible Duplicate:
Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask?
What do the following lines mean? I am sorry, I am a new learner of regular expressions.
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteCond %1/%{REQUEST_FILENAME} -f
RewriteCond %1/%{REQUEST_FILENAME} -d
RewriteRule index.php?=%{REQUEST_FILENAME} [L]
After reading some Apache rewrite documentation, I now have some basic knowledge, but I still can't understand some part of the above lines well.
%{HTTP_HOST}
the requset domain
[NC]
(case insensitive)
L
(last - stop processing rules)
-f
if Something_to_test is a file
-d
if Something_to_test is a directory
%{REQUEST_FILENAME}
the requset file name
What does the
$
mean in (^www\.(.*)$
). All the URLs that are requested by the client are all beginning bywww.
. Am I right?What's the meaning
%1/%
?RewriteRule index.php?=%{REQUEST_FILENAME}
If the three RewriteCond
s are all right, it will execute the RewriteRule
line. What does the rule mean?