Reputation: 853
I read many discussions related two mod rewrite using htaccess from stackoverflow. But nothing works well for me. This is my url, www.website.com/image.php?category=animals&name=tiger
and I would like to change it into clean url as below. http://www.website.com/animal/tiger
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)$ category.php?tag=$1 [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)$ covers.php?tag=$1&name=$2 [L]
</IfModule>
www.website.com/animal/tiger
is working well, but when I click on (categories) www.website.com/animal/
,it is not showing results.
Upvotes: 1
Views: 63
Reputation: 1309
I think that you're missing ending slash check in rules:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ category.php?tag=$1 [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ covers.php?tag=$1&name=$2 [L]
</IfModule>
Please try that.
Upvotes: 2