Apache 将vhost.conf转换为.htaccess
大多数人似乎都在询问如何将.htaccess转换为vhost.conf。我需要相反的东西。我有一个现有的vhost.conf文件,看起来像这样Apache 将vhost.conf转换为.htaccess,apache,.htaccess,vhosts,Apache,.htaccess,Vhosts,大多数人似乎都在询问如何将.htaccess转换为vhost.conf。我需要相反的东西。我有一个现有的vhost.conf文件,看起来像这样 ServerAlias base1.mydomain.com ServerAlias base2.mydomain.com ServerAlias base3.mydomain.com ServerAlias www.mysite1.co.uk ServerAlias www.mysite2.co.uk RewriteEngine on
ServerAlias base1.mydomain.com
ServerAlias base2.mydomain.com
ServerAlias base3.mydomain.com
ServerAlias www.mysite1.co.uk
ServerAlias www.mysite2.co.uk
RewriteEngine on
RewriteMap lowercase int:tolower
RewriteCond %{REQUEST_URI} !^/images/
RewriteCond %{REQUEST_URI} !^/code/
RewriteCond %{REQUEST_URI} !^/php/
RewriteCond %{REQUEST_URI} !^/php-bin/
RewriteCond %{REQUEST_URI} !^/syles/
RewriteCond %{REQUEST_URI} !^/js/
RewriteCond %{REQUEST_URI} !^/jquery/
RewriteRule ^/(.*)$ /var/www/vhosts/mydomain.com/subdomains/${lowercase:%{SERVER_NAME}}/htdocs/$1
Alias /scripts/ "/var/www/vhosts/mydomain.com/subdomains/ysite/V4_0_1/scripts/"
Alias /php/ "/var/www/vhosts/mydomain.com/subdomains/ysite/V4_0_1/php-bin/"
<Files ~ (\.phtml)>
SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .phtml
Options +ExecCGI
allow from all
</Files>
<Files ~ (\.php)>
SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php
Options +ExecCGI
allow from all
</Files>
<Files ~ (\.php4)>
SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php4
Options +ExecCGI
allow from all
</Files>
Alias /php-bin/ "/var/www/vhosts/mydomain.com/subdomains/ysite/V4_5/php-bin/"
Alias /js/ "/var/www/vhosts/mydomain.com/subdomains/ysite/V4_5/js/"
Alias /css/ "/var/www/vhosts/mydomain.com/subdomains/ysite/V4_5/styles/"
Alias /jquery/ "/var/www/vhosts/mydomain.com/subdomains/ysite/V4_5/jquery/"
ServerAlias base1.mydomain.com
ServerAlias base2.mydomain.com
ServerAlias base3.mydomain.com
ServerAlias www.mysite1.co.uk
ServerAlias www.mysite2.co.uk
重新启动发动机
重写映射小写int:tolower
重写cond%{REQUEST_URI}^/图像/
重写cond%{REQUEST_URI}^/代码/
重写cond%{REQUEST_URI}^/php/
重写cond%{REQUEST_URI}^/php垃圾箱/
重写cond%{REQUEST_URI}^/西尔斯/
重写cond%{REQUEST_URI}^/js/
重写cond%{REQUEST_URI}^/jquery/
重写规则^/(.*)$/var/www/vhosts/mydomain.com/subdomains/${小写:%{SERVER_NAME}}}/htdocs/$1
别名/scripts/“/var/www/vhosts/mydomain.com/subdomains/ysite/V4_0_1/scripts/”
别名/php/“/var/www/vhosts/mydomain.com/subdomains/ysite/V4_0_1/php bin/”
SetHandler fcgid脚本
FCGIWrapper/var/www/cgi-bin/cgi\u-wrapper/cgi\u-wrapper.phtml
选项+执行CGI
通融
SetHandler fcgid脚本
FCGIWrapper/var/www/cgi-bin/cgi\u-wrapper/cgi\u-wrapper.php
选项+执行CGI
通融
SetHandler fcgid脚本
FCGIWrapper/var/www/cgi-bin/cgi\u-wrapper/cgi\u-wrapper.php4
选项+执行CGI
通融
别名/php-bin/“/var/www/vhosts/mydomain.com/subdomains/ysite/V4_5/php-bin/”
别名/js/“/var/www/vhosts/mydomain.com/subdomains/ysite/V4_5/js/”
别名/css/“/var/www/vhosts/mydomain.com/subdomains/ysite/V4_5/styles/”
别名/jquery/“/var/www/vhosts/mydomain.com/subdomains/ysite/V4_5/jquery/”
我正在尝试将其转换为.htaccess文件。从顶部开始,serveralias的.htaccess命令等效于什么?并非所有
vhost.conf
的命令都可以复制到.htaccess,因为.htaccess
中不允许所有指令
您可以将此代码放在文档\u ROOT/.htaccess
文件中:
RewriteEngine on
RewriteCond ${HOST_NAME} [A-Z]
RewriteCond %{REQUEST_URI} !^/(images|code|php|php-bin|styles|js|jquery)/
RewriteRule ^(.*)$ http://${lowercase:%{HOST_NAME}}/$1 [L,R]
<Files ~ (\.phtml)>
SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .phtml
Options +ExecCGI
allow from all
</Files>
<Files ~ (\.php)>
SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php
Options +ExecCGI
allow from all
</Files>
<Files ~ (\.php4)>
SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php4
Options +ExecCGI
allow from all
</Files>
重新编写引擎打开
重写cond${HOST_NAME}[A-Z]
重写cond%{REQUEST_URI}^/(图像|代码| php | php bin |样式| js | jquery)/
重写规则^(.*)$http://${小写:%%{HOST_NAME}}/$1[L,R]
SetHandler fcgid脚本
FCGIWrapper/var/www/cgi-bin/cgi\u-wrapper/cgi\u-wrapper.phtml
选项+执行CGI
通融
SetHandler fcgid脚本
FCGIWrapper/var/www/cgi-bin/cgi\u-wrapper/cgi\u-wrapper.php
选项+执行CGI
通融
SetHandler fcgid脚本
FCGIWrapper/var/www/cgi-bin/cgi\u-wrapper/cgi\u-wrapper.php4
选项+执行CGI
通融