L
L
lilwings2019-12-23 15:42:47
Yii
lilwings, 2019-12-23 15:42:47

Yii2 why do paths with / at the beginning not work?

Does not work :

style="background-image: url('/images/header/header.jpg')"

Works:
style="background-image: url('images/header/header.jpg')"

File system:
5e00b58315a70009176957.png
.htaccess:
web
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]

Application Root:
<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine on
</IfModule>

<IfModule mod_rewrite.c>
    RewriteCond %{REQUEST_URI} ^/.*
    RewriteRule ^(.*)$ web/$1 [L]

    RewriteCond %{REQUEST_URI} !^/web/
    RewriteCond %{REQUEST_FILENAME} !-f [OR]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^.*$ web/index.php
</IfModule>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2019-12-23
@lilwings

Where do you see the absolute path here? Read

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question