通过.htaccess文件配置apache虚拟主机

时间:2019-03-19 13:17:56

标签: php apache file

我有这个.htaccess文件

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule token token.php 
RewriteRule verify token.php 

我在服务器中拥有的网址  [https://api-caixinhadeareia.meusite.com.br/oauth2/token.php][1]

我想通过访问 https://api-caixinhadeareia.meusite.com.br/oauth2/token

我在虚拟主机中的常规配置是:

<VirtualHost *:80>
        ServerAdmin it@meunegocio.com.br
        ServerName api-caixinhadeareia.meunegocio.com.br

        DocumentRoot /meu-cluster/league/m/api.meunegocio.com.br/html

        <Directory /meu-cluster/league/m/api.meunegocio.com.br/html>
                Options None
                AllowOverride None
        Require all granted
        </Directory>

        php_admin_flag safe_mode Off
        php_admin_value suhosin.executor.func.blacklist "phpinfo"

        ErrorLog /var/log/apache2/api-caixinhadeareia.meunegocio.com.br-error.log
        CustomLog /var/log/apache2/api-caixinhadeareia.meunegocio.com.br-access.log combined
        CustomLog /var/log/apache2/api-caixinhadeareia.meunegocio.com.br-deflate.log deflate

        RewriteEngine on
        RewriteCond %{SERVER_NAME} =api-caixinhadeareia.meunegocio.com.br
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<IfModule mod_ssl.c>
        <VirtualHost *:443>
                ServerAdmin teste@meunegocio.com.br
                ServerName api-caixinhadeareia.meunegocio.com.br

                DocumentRoot /meu-cluster/league/m/api.meunegocio.com.br/html

                <Directory /meu-cluster/league/m/api.meunegocio.com.br/html>
                        Options None
                    AllowOverride None
                    Require all granted
            </Directory>

            php_admin_flag safe_mode Off
            php_admin_value suhosin.executor.func.blacklist "phpinfo"

            ErrorLog /var/log/apache2/api-caixinhadeareia.meunegocio.com.br_SSL-error.log
            CustomLog /var/log/apache2/api-caixinhadeareia.meunegocio.com.br_SSL-access.log combined
            CustomLog /var/log/apache2/api-caixinhadeareia.meunegocio.com.br_SSL-deflate.log deflate


            Include /etc/notherebro/options-ssl-apache.conf
            SSLCertificateFile /etc/notherebro/live/myhideserver.meunegocio.com.br/myhidekeys.pem
            SSLCertificateKeyFile /etc/notherebro/live/myhideserver.meunegocio.com.br/myhidekeysprivate.pem
    </VirtualHost>

我想将.htaccess中的配置导入到virtualhosts文件中,该怎么做?我尝试了很多方法,但没有任何效果。

0 个答案:

没有答案