RomkaChev
RomkaChev

Reputation: 31

How to prevent the execution of php, even if the file is not found?

I have the following .htaccess:

RewriteEngine on

# If a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Otherwise forward it to index.php
RewriteRule . index.php

There is a lot of requests to that url /static/tiles/z/x/y.png.

Now, if file was not found, index.php handles the request.

But i want to if the request matches /static/tiles/.* and there is no such file, apache is just stop execution.

Upvotes: 0

Views: 18

Answers (1)

Charlotte Dunois
Charlotte Dunois

Reputation: 4680

Add the following condition to your .htaccess

RewriteCond %{REQUEST_URI} !^/static/tiles/.*

This will prevent your rule to be met when the requested uri starts with /static/tiles.

Upvotes: 1

Related Questions