D
D
Dmitry Yakovlev2018-11-01 10:38:04
Yii
Dmitry Yakovlev, 2018-11-01 10:38:04

How to redirect apache folder?

In the advanced template, it is necessary to put the files that will be used both on the back and on the front into a shared folder - contentRoot.
I'm trying to make a redirect for images in htaccess:

RewriteRule ^images/(.*)$ contentRoot/images/$1 [L]

Full code:
<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On
</IfModule>

<IfModule mod_rewrite.c>
    RewriteRule ^images/(.*)$ contentRoot/images/$1 [L]

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

Please tell me what is wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2018-11-01
@shambler81

The most correct option is to use a lnsoft link.
And don't play jokes with redirects.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question