Many posters have problems debugging their RewriteRule and RewriteCond statements within their .htaccess
files. Most of these are using a shar
Some mistakes I observed happens when writing .htaccess
Using of ^(.*)$
repetitively in multiple rules, using ^(.*)$
causes other rules to be impotent in most cases, because it matches all of the url in single hit.
So, if we are using rule for this url sapmle/url
it will also consume this url sapmle/url/string
.
[L] flag should be used to ensure our rule has done processing.
Should know about:
%n
is matched during %{RewriteCond}
part and $n
is matches on %{RewriteRule}
part.
The RewriteBase directive specifies the URL prefix to be used for per-directory (htaccess) RewriteRule directives that substitute a relative path.
This directive is required when you use a relative path in a substitution in per-directory (htaccess) context unless any of the following conditions are true:
The original request, and the substitution, are underneath the DocumentRoot (as opposed to reachable by other means, such as Alias). The filesystem path to the directory containing the RewriteRule, suffixed by the relative substitution is also valid as a URL path on the server (this is rare). In Apache HTTP Server 2.4.16 and later, this directive may be omitted when the request is mapped via Alias or mod_userdir.