0

我可能做错了什么,但是当我部署 symfony 项目以从 URL 中删除 /web/ 部分时,我使用 .htaccess 文件:

RewriteEngine on
RewriteBase /web/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]

正因为如此,我需要添加web/到所有资产,如 css 文件、js 文件图像。但是当我将它添加到我使用 LiipImagineBundle 生成为它们生成的拇指 URL 的图像中时:

http://example.com/media/cache/resolve/thumb_263x140/web/uploads/mainPhotos/ae34833f0ffe84437e6688f4588771f981bb4408.jpeg

而不是我需要的: http ://example.com/web/media/cache/resolve/thumb_263x140/uploads/mainPhotos/ae34833f0ffe84437e6688f4588771f981bb4408.jpeg

第一个 URL 的代码是{{ ('web/uploads/mainPhotos/' ~ article.path)| imagine_filter('thumb_263x140') }}

如果我之前尝试添加web/部分{{ ...... }}src="web/{{ ('uploads/mainPhotos/' ~ article.path)| imagine_filter('thumb_263x140') }}"我会得到 URL http://example.com/web/http://test4.einius.lt/media/cache/thumb_263x140/uploads/mainPhotos/ae34833f0ffe84437e6688f4588771f981bb4408.jpeg

如何获得正确的 URL?

4

0 回答 0