w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Rewrite File With Condition (If Elseif Else) Htaccess

Simply use 3 rules:

RewriteRule ^image/([^/]+)/([^/]+)/([^/]+)$                
/image.php?width=$1&height=$2&src=$3 [QSA,L]
RewriteRule ^image/([^/]+)/([^/]+)/([^/]+)/([^/]+)$        
/image.php?width=$1&height=$2&ratio=$3&src=$4 [QSA,L]
RewriteRule ^image/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$

If it catch the first rule, the second and the third won't be executed (thanks to the [L] tag, which stop .htaccess execution on catch).

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.