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 mod_重写无法正常工作_Apache_Yii2_Centos - Fatal编程技术网

Apache mod_重写无法正常工作

Apache mod_重写无法正常工作,apache,yii2,centos,Apache,Yii2,Centos,已安装Yi2 advanced。我无法在服务器上配置apache。它值百分之一百。Apache配置如下所示。主站点位于:tickets.example.ru,管理区域位于:tickets.example.com/admin 当您为任何链接(例如“/admin/user/login”)登录到管理面板时,出于某种原因,Apache会在前端查找所有内容。认为管理员是一个控制器 <VirtualHost *:443> ServerName tickets.example.ru Ser

已安装Yi2 advanced。我无法在服务器上配置apache。它值百分之一百。Apache配置如下所示。主站点位于:tickets.example.ru,管理区域位于:tickets.example.com/admin

当您为任何链接(例如“/admin/user/login”)登录到管理面板时,出于某种原因,Apache会在前端查找所有内容。认为管理员是一个控制器

    <VirtualHost *:443>
ServerName tickets.example.ru
ServerAdmin example@example.ru
Alias /admin "/var/www/vhost/tickets.example.ru/htdocs/backend/web/"
DocumentRoot "/var/www/vhost/tickets.example.ru/htdocs/frontend/web/"
Options FollowSymLinks
DirectoryIndex index.php index.html
RewriteEngine on

RewriteRule /\. - [L,F]
RewriteRule ^/admin$ /admin/ [L,PT]

<Directory /var/www/vhost/tickets.example.ru/htdocs/frontend/web/>
    AllowOverride none
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # otherwise forward the request to index.php
    RewriteRule ^ index.php [L]
</Directory>

<Directory "/var/www/vhost/tickets.example.ru/htdocs/backend/web/">
    RewriteEngine on
    AllowOverride none
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # otherwise forward the request to index.php
    RewriteRule ^ index.php [L]
</Directory>

<Directory "/var/www/vhost/tickets.example.ru/htdocs/phpMyAdmin/">
    RewriteEngine on
    AllowOverride All
</Directory>

ErrorLog    /var/www/vhost/tickets.example.ru/logs/http_error.log
TransferLog /var/www/vhost/tickets.example.ru/logs/http_access.log

ServerName tickets.example.ru
服务器管理员example@example.ru
别名/admin”/var/www/vhost/tickets.example.ru/htdocs/backend/web/“
DocumentRoot“/var/www/vhost/tickets.example.ru/htdocs/frontend/web/”
选项如下符号链接
DirectoryIndex.php index.html
重新启动发动机
重写规则/\。-[L,F]
重写规则^/admin$/admin/[L,PT]
不允许超限
重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
#否则,将请求转发到index.php
重写规则^index.php[L]
重新启动发动机
不允许超限
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
#否则,将请求转发到index.php
重写规则^index.php[L]
重新启动发动机
允许超越所有
ErrorLog/var/www/vhost/tickets.example.ru/logs/http_error.log
TransferLog/var/www/vhost/tickets.example.ru/logs/http_access.log

为什么不为tickets.ru.com和admin.tickets.ru.com这样的应用程序映射两个不同的虚拟主机呢?这会让你的生活更轻松?