URL Rewriting URL Rewrite Rules
URL Rewrite Rules: Patterns
pattern is matched relative to the current directory
not the original requested URI
; the directory path where the rule is defined is stripped from the
currently mapped filesystem path before matching
(up to and including a trailing slash)
#
∼
sgxyz / publi c_h tml / a /. ht acce ss
Rew rit eRule b/ file1 . html file2 . htm
http://student.csc.liv.ac.uk/
∼
sgxyz/A/file1.html
Mapped path is
∼
sgxyz/public_html/A/file1.html
URL is not affected by the rewrite rule as
∼
sgxyz/public_html/A/
is a not
∼
sgxyz/public_html/a/ nor a subdirectory of it
http://student.csc.liv.ac.uk/
∼
sgxyz/a/file1.html
Mapped path is
∼
sgxyz/public_html/a/file1.html
Prefix up to directory a/ will be stripped file1.html
Pattern b/file1.html
does not match file1.html , the rule has no effect
COMP519 Web Programming Lecture 28 Slide L28 – 10