S
S
SidorKovpak2019-01-23 13:28:21
Yii
SidorKovpak, 2019-01-23 13:28:21

Wordpress + yii2 on the same domain. How to organize apache routing (.htaccess)?

Good afternoon dear community.
Tell me how to organize routing through apache for 2 entry points.
There is a site on wordpress and a personal account for users on yii2.
I added the prodlk folder to the root of the WordPress site, in which I added the yii2 script for my personal account.
In the root .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On

# BEGIN YII2
RewriteCond %{REQUEST_URI} !^/lk/
RewriteRule ^(.*)$ prodlk/web/$1 [NC,L,QSA]
# END YII2

# BEGIN WordPress
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
</IfModule>

In the .htaccess file in the folder (prodlk/web) it is standard:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

For any request containing /lk, apache sends a request to prodlk/web/index.php, but pathInfo is empty because of this, the routing rule '' (empty or default request) in yii2 is triggered.
How to properly organize the transfer of requests to the yii2 script?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
morricone85, 2019-01-23
@morricone85

I will not answer everything on the topic of the question, is it worth it, is it not possible to implement a personal account in wordpress?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question