Well, the RewriteBase
is a directive that specifies the URL prefix that will be used to replace a relative path, i.e., you can write a base path for your rewrites
. It is quite useful in situations where your code is not in the server root directory.
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 directory root
application is not in the same server directory, so with the RewriteBase
you will be telling the server that when that route is requested it should run the application located in the /opt/myapp-1.2.3
.
As to the mod_rewrite
, is the module responsible for working with the writing rules of the friendly Urls that will be defined in .htaccess
.
Note: this example has as assumptions
DocumentRoot /var/www/example.com
andAlias /myapp /opt/myapp-1.2.3
.– bfavaretto