Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 将vhost.conf转换为.htaccess_Apache_.htaccess_Vhosts - Fatal编程技术网

Apache 将vhost.conf转换为.htaccess

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

大多数人似乎都在询问如何将.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

    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
通融