M
M
Maxim Timofeev2014-12-19 20:40:41
Yii
Maxim Timofeev, 2014-12-19 20:40:41

How to configure htaccess for Yii2 to access the common/image folder?

I'm using htaccess peeped for advanced yii2 template. I do not understand how, but it does not allow access to the folder with pictures, which is located in common / images, as well as in frontend / web / images
Who knows what's wrong?

<IfModule mod_rewrite.c>

    Options +FollowSymlinks

    RewriteEngine On

</IfModule>

 

<IfModule mod_rewrite.c>

    # deal with admin first

    RewriteCond %{REQUEST_URI} ^/(admin)

    RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L]

    RewriteRule ^admin/css/(.*)$ backend/web/css/$1 [L]

 

    RewriteCond %{REQUEST_URI} !^/backend/web/(assets|css)/

    RewriteCond %{REQUEST_URI} ^/(admin)

    RewriteRule ^.*$ backend/web/index.php [L]

 

    RewriteCond %{REQUEST_URI} ^/(assets|css)

    RewriteRule ^assets/(.*)$ frontend/web/assets/$1 [L]

    RewriteRule ^css/(.*)$ frontend/web/css/$1 [L]

 

    RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css)/

    RewriteCond %{REQUEST_URI} !index.php

    RewriteCond %{REQUEST_FILENAME} !-f [OR]

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^.*$ frontend/web/index.php

</IfModule>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2014-12-19
@webinar

Understood
added to the folder with pictures .htaccess with the following content

<IfModule mod_rewrite.c>
      # If a directory or a file exists, use the request directly
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      # Otherwise forward the request to frontend/web/index.php
      RewriteRule ^(.*)$ /frontend/web/index.php
  </IfModule>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question