Apache mod_重写无法正常工作
已安装Yi2 advanced。我无法在服务器上配置apache。它值百分之一百。Apache配置如下所示。主站点位于:tickets.example.ru,管理区域位于:tickets.example.com/admin 当您为任何链接(例如“/admin/user/login”)登录到管理面板时,出于某种原因,Apache会在前端查找所有内容。认为管理员是一个控制器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
<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这样的应用程序映射两个不同的虚拟主机呢?这会让你的生活更轻松?