simPod
simPod

Reputation: 13456

Exclude request with get parameter from .htaccess rule

I have this htaccess rule:

RewriteCond %{REQUEST_URI} !assets
RewriteRule \.(?:jpe?g|gif|png)$ script.php

It redirects all image requests to script.php. I'd like to exclude all requests that contain GET parameter, for example http://myweb.com/image.jpg?process=0 but have http://myweb.com/image.jpg included.

How should I edit my rule? Thanks

Upvotes: 2

Views: 658

Answers (1)

Oussama Jilal
Oussama Jilal

Reputation: 7739

Then you should test on the %{QUERY_STRING} if does contain something :

RewriteCond %{REQUEST_URI} !assets
RewriteCond %{QUERY_STRING} !.+
RewriteRule \.(?:jpe?g|gif|png)$ script.php

Upvotes: 2

Related Questions