A
A
Anton Nadtoka2016-07-11 18:32:32
Yii
Anton Nadtoka, 2016-07-11 18:32:32

How to set up Yii2 and Opencart?

There is a site on Yii2 in which the CNC is configured. The subfolder contains a store in the form of Opencart. How to properly set up configs for apache2 so that the store engine works independently. Now when you go to the subfolder link, the site itself is loaded on Yii2.
example.com - Yii2
example.com/shop - Opencart
how to properly set up .htaccess and apache configs?
Added configs:
yii2\htaccess

<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On
</IfModule>
 
<IfModule mod_rewrite.c>
    # deal with admin first
    RewriteRule ^shop/(.*)$ shop/$1 [L,QSA]
  
    RewriteCond %{REQUEST_URI} ^/(admin)
    RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L]
    RewriteRule ^admin/css/(.*)$ backend/web/css/$1 [L]
    RewriteRule ^admin/js/(.*)$ backend/web/js/$1 [L]

    RewriteCond %{REQUEST_URI} !^/backend/web/(assets|css|js)/
    RewriteCond %{REQUEST_URI} ^/(admin)
    RewriteRule ^.*$ backend/web/index.php [L]

    RewriteCond %{REQUEST_URI} ^/(assets|css|js|images)
    RewriteRule ^assets/(.*)$ frontend/web/assets/$1 [L]
    RewriteRule ^css/(.*)$ frontend/web/css/$1 [L]
    RewriteRule ^js/(.*)$ frontend/web/js/$1 [L]
    RewriteRule ^images/(.*)$ frontend/web/images/$1 [L]
    RewriteRule ^(.*)$ frontend/web/$1 [L]

    RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css|js)/
    RewriteCond %{REQUEST_URI} !index.php
    RewriteCond %{REQUEST_FILENAME} !-f [OR]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^.*$ frontend/web/index.php
</IfModule>

opencart\htaccess
Options +FollowSymlinks
Options -Indexes

<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
 Order deny,allow
 Deny from all
</FilesMatch>

RewriteEngine On

RewriteBase /shop
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

now how the apache config should look like or what to add

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2016-07-11
@webinar

just redirect root to index.php yii and /shop to index.php Opencart, it's all done in .htaccess
gering111.com/10-nastroek-htaccess

W
web-mechanic, 2016-07-11
@amfetamine

What is the RewriteBase in .htaccess for opencart?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question