Is it possible to route files (* .jpg)?

heger.ITS
Member | 2
+
0
-

Hi there!
I want to use the nette-palette component. The generated image is routed in a new path.
Sample :https://localhost/…86422461.jpg?…

According to the description, only a new route has to be created:

$router[] = new Route('files/thumbs/<path .+>', 'Palette:Palette:image');

But it does not work. Can I resolve files in a route? (*.jpg)

THX!

David Matějka
Moderator | 6252
+
+2
-

Hi, make sure that your webserver is routing all traffic to php application. often there is a condition (in htaccess, nginx config etc.) to intercept images and other static files

heger.ITS
Member | 2
+
0
-

David Matějka wrote:

Hi, make sure that your webserver is routing all traffic to php application. often there is a condition (in htaccess, nginx config etc.) to intercept images and other static files

THX! It Works.

This is my new .htaccess:

# Apache configuration file (see https://httpd.apache.org/docs/current/mod/quickreference.html)
Require all granted

# disable directory listing
<IfModule mod_autoindex.c>
	Options -Indexes
</IfModule>

# enable cool URL
<IfModule mod_rewrite.c>
	RewriteEngine On
	# RewriteBase /

	# use HTTPS
	# RewriteCond %{HTTPS} !on
	# RewriteRule .? https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

	# prevents files starting with dot to be viewed by browser
	RewriteRule /\.|^\.(?!well-known/) - [F]

	# front controller
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteRule ^(.*)$ index.php?file=$1 [L,QSA]
</IfModule>

# enable gzip compression
<IfModule mod_deflate.c>
	<IfModule mod_filter.c>
		AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript application/json application/xml image/svg+xml
	</IfModule>
</IfModule>