Play the Apache rewrite rules tonight and discover some of the details that are easy to ignore and share.
First, describe the other related configurations of the instance environment:
Documentroot/var/www/html
The placement path of the. htaccess/var/www/html/l-production/public
1. Replace the "absolute" and "relative" rules, for example:
1 # Redirect Trailing slashes ... 2 rewriterule ^ (. *)/$/$1 [l,r=301]
This is an implementation that uses redirection to eliminate the last slash of the URL, where it is important to note the /$1 Slash, which is an "absolute" notation when I enter HTTP://127.0.0.1/in the browser l-production/public/js/, the URL is redirected to Http://127.0.0.1/js, and when I remove the /$1 slash, the URL is redirected to the expected HTTP// 127.0.0.1/l-production/public/js.
2. The pattern matching object is not related to rewritebase, but only with the directory where the. htaccess is located, for example:
1 rewritebase/l-Production23# Redirect Trailing slashes ... 4 rewriterule ^ (. *)/$ $1 [l,r=301]
In the browser input Http://127.0.0.1/L-Production/public/js/,url will be redirected to Http://127.0.0.1/L-Production/js, not HTTP://127.0.0.1/ L-production/public/js.
This shows that ^ (. *)/$ matches the string is js/, instead of the URL that removes the/l-production public/js,rewritebase only affects the substitution rule.
In addition, I also found in the final test that when you add a slash here, the redirect result is still http://127.0.0.1/L-Production/js, which means that after setting the rewritebase, all the substitution rules become "absolute".
apache2.4.7. htaccess rewrite Some details of the URL