I'm trying to use RewriteMap
in my virtualhost, but not getting any luck.
Here is the content of my virtualhost file, with an entry (line) starting with RewriteMap
. From what I read, the file /etc/fixit.php
should be executed. But I tested to put a simple line file_put_contents('/etc/test.txt','abcd', FILE_APPEND);
and the test.txt file is not created.
<VirtualHost *:80>
SuexecUserGroup "#1004" "#1004"
ServerName test2.domain.com
ServerAlias www.test2.domain.com
DocumentRoot /home/test2/public_html
ErrorLog /var/log/virtualmin/test2.domain.com_error_log
ErrorDocument 403 "This is the default page for new website."
CustomLog /var/log/virtualmin/test2.domain.com_access_log combined
ScriptAlias /cgi-bin/ /home/test2/cgi-bin/
ScriptAlias /awstats/ /home/test2/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
RewriteMap fixurl prg:/etc/fixit.php
<Directory /home/test2/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php .php
AddHandler fcgid-script .php
AddHandler fcgid-script .php7.0
FCGIWrapper /home/test2/fcgi-bin/php7.0.fcgi .php
FCGIWrapper /home/test2/fcgi-bin/php7.0.fcgi .php7.0
</Directory>
<Directory /home/test2/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RemoveHandler .php
RemoveHandler .php7.0
php_admin_value engine Off
FcgidMaxRequestLen 1073741824
<Files awstats.pl>
AuthName "test2.domain.com statistics"
AuthType Basic
AuthUserFile /home/test2/.awstats-htpasswd
require valid-user
</Files>
php_value memory_limit 32M
IPCCommTimeout 41
</VirtualHost>
Here is the content of my test /etc/fixit.php
file
<?php
file_put_contents('/etc/test.txt','abcd', FILE_APPEND);
?>
I understand that this is not a complete RewriteMap example, since I haven't added a rewrite rule to the file. But at least the fixit.php
file should be executed, is it correct?
Thanks for any help.