How does RewriteBase work in .htaccess

In my own words, after reading the docs and experimenting: You can use RewriteBase to provide a base for your rewrites. Consider this This is a real rule I used to ensure that URLs have a trailing slash. This will convert to By having the RewriteBase there, you make the relative path come off the RewriteBase parameter.

How to enable mod_rewrite for Apache 2.2

In order to use mod_rewrite you can type the following command in the terminal: Restart apache2 after or or as per new unified System Control Way Then, if you’d like, you can use the following .htaccess file. The above .htaccess file (if placed in your DocumentRoot) will redirect all traffic to an index.php file in the DocumentRoot unless the file exists. So, let’s say you have … Read more

.htaccess – how to force “www.” in a generic way?

I would use this rule: The first condition checks whether the Host value is not empty (in case of HTTP/1.0); the second checks whether the the Host value does not begin with www.; the third checks for HTTPS (%{HTTPS} is either on or off, so %{HTTPS}s is either ons or offs and in case of ons the s is matched). The substitution part of RewriteRule then just merges the information parts to a full URL.