Well, RewriteBase
is a directive that specifies the prefix of the URL that will be used to replace a relative path, that is, you can write a base path for your rewrites
. It is very useful in situations where your code is not in the root directory of the server.
This is a very simple example, taken from Apache documentation , which represents the operation of RewriteBase
.
<Directory /opt/myapp-1.2.3>
RewriteEngine On
RewriteBase /myapp/
RewriteRule ^index\.html$ welcome.html
</Directory>
In this case the root
directory of the application is not in the same directory as the server, so with RewriteBase
you will be telling the server that when that route is requested it should run the application located in% / p>
As for /opt/myapp-1.2.3
, it is the module responsible for working with the writing rules of friendly URLs that will be defined in mod_rewrite
.