Reputation: 196
Having the following code I cant configurate .htaccess. It takes .js and .css files, but not takes .png images
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^(.*)/\.(jpg|css|js|gif|png)$ [NC]
RewriteRule ^([^/]+)/([^/]+)$ index.php?$1=$2
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)$ index.php?$1=$2&$3=$4
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ index.php?$1=$2&$3=$4&$5=$6
Any idea?
Upvotes: 1
Views: 43
Reputation: 143876
RewriteCond conditions only get applied to the immediately following RewriteRule, so those conditions you have only get applied to the first rule. You need to duplicate them for the other 2 rules if you want them to be applied to those as well:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^(.*)/\.(jpg|css|js|gif|png)$ [NC]
RewriteRule ^([^/]+)/([^/]+)$ index.php?$1=$2
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^(.*)/\.(jpg|css|js|gif|png)$ [NC]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)$ index.php?$1=$2&$3=$4
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^(.*)/\.(jpg|css|js|gif|png)$ [NC]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)$ index.php?$1=$2&$3=$4&$5=$6
Upvotes: 1