Home › Forums › Other › How to remove subdirectories using mod_rewrite in .htaccess › Reply To: How to remove subdirectories using mod_rewrite in .htaccess
July 30, 2014 at 12:06 am
#176878
Participant
%{THE_REQUEST}
is an Apache variable. Its value is the actual request line* from the HTTP request, unchanged by any rewrites (which is the reason it does not cause a redirect loop).
* for example:
GET /index.html HTTP/1.1
\w-
is actually -
(a dash) and \w
(a “word” character; meaning alphanumerics or an underscore). Put together, [\w-]
is just a shorter, more succinct way to write [a-zA-Z0-9_-]
.
%1
is a numbered backreference, just like $1
would be. The difference is that %
backreferences refer to capture groups in RewriteCond
s, while $
backreferences refer to capture groups in RewriteRule
s.