无效的命令“location”,可能是由服务器配置中未包含的模块拼写错误或定义的

Currently, I am setting my local environment for a project.

Project runs on production environment with nginx server. But in the local development, using apache server. I've installed LAMP stack on my ubuntu machine. There is already a virtual host file provided and I have setup it. So far I've created xxx.conf file under /etc/apache2/sites-available.

The file includes:

<VirtualHost *:80>        
 ServerName xxx     
 DocumentRoot /home/ubuntuser/Downloads/xxx-master/public

 <Directory "/home/ubuntuser/Downloads/xxx-master/public">            
    Options Indexes FollowSymLinks Includes ExecCGI            
    AllowOverride all            
    Require all granted        
 </Directory>

 ErrorLog ${APACHE_LOG_DIR}/xxx-error.log        
 CustomLog ${APACHE_LOG_DIR}/xxx-access.log combined        
 SetEnv ENVIRONMENT "development"
</VirtualHost>


I also created .htaccess file under /home/ubuntuser/Downloads/xxx-master/public. The content of this file downloaded from production environment.

The content of .htaccess file is:

RewriteEngine On 
RewriteBase / 
location ~ ^/site { rewrite ^/site(.*)$ https://local.xxx.com/$1 redirect;}

So, when I type local.xxx.com in browser, it gives 500 Internal Error.

So, I was defined xxx-error.log in virtual host config file. I've opened it. The content is:

[Tue May 28 22:23:33.231851 2019] [core:alert] [pid 5677] [client 127.0.0.1:56504] /home/ubuntuser/Downloads/xxx-master/public/.htaccess: RewriteBase takes one argument, the base URL of the per-directory context
[Tue May 28 22:23:33.254608 2019] [core:alert] [pid 5678] [client 127.0.0.1:56506] /home/ubuntuser/Downloads/xxx-master/public/.htaccess: RewriteBase takes one argument, the base URL of the per-directory context, referer: http://local.xxx.com/
[Tue May 28 22:33:22.300863 2019] [core:alert] [pid 6326] [client 127.0.0.1:56740] /home/ubuntuser/Downloads/xxx-master/public/.htaccess: Invalid command 'location', perhaps misspelled or defined by a module not included in the server configuration
[Tue May 28 22:33:22.317420 2019] [core:alert] [pid 6327] [client 127.0.0.1:56742] /home/ubuntuser/Downloads/xxx-master/public/.htaccess: Invalid command 'location', perhaps misspelled or defined by a module not included in the server configuration, referer: http://local.xxx.com/

So, I understand there is problem in the .htaccess but i don't know how to solve it.