문제

I am using excellent https://github.com/liip/LiipImagineBundle bundle for showing images. But when working in dev enviroment, generated urls become something like:

<img src="/app_dev.php/media/cache/60x60/somefile.jpg">

and when there are 20-30 images, my programs crawls. I also get lots of connection timeouts because app_dev.php goes thru entire FW.

Question: Can I somehow set Symfony to generate production URL for some parts, while still in dev? Ie. that LiipImagineBundle always generate production URL, no matter what enviroment is?

Or how can I change .htaccess to use

/media/cache/60x60/file.jpg

whenever there is

app_dev.php/media/cache/* 

found

도움이 되었습니까?

해결책

You can use this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteRule ^app_dev\.php(/media/cache/.*)$ $1 [L,R=301,NC]

Reference: Apache mod_rewrite Introduction

다른 팁

You can try adding (preferably before any other rules but after any redirect rules) this in the htaccess file in your document root:

RewriteEngine On
RewriteRule ^app_dev\.php/media/cache/(.*)$ /media/cache/$1 [L]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top