L
L
Leopandro2017-10-02 20:18:01
Yii
Leopandro, 2017-10-02 20:18:01

How to output .jpg .png etc from a different @web folder?

I have pictures, let's say, are located in the files folder in the root folder of the project. how can I display them for the user if I have this in htaccess:

<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|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>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor Vasiliev, 2017-10-02
@Isolution666

Hello.
---
What you are talking about is called a namespace, configured in the config
folder You can use adminLTE - there is a setting to show the directory while hiding
/frontend/web/ and backend.
https://github.com/almasaeed2010/AdminLTE
Let's say if you create an image folder in the web folder, for example, the image
will be displayed in this case like this:
/image/1.jpg

M
Maxim Timofeev, 2017-10-03
@webinar

You should not store files outside the webroot, or rather give access to them. You need to solve the problem so that the files are in the descendant of @web

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question