Q:

simple htaccess redirect

It's a part of my htaccess:
RewriteRule ^post/(.*)$ post.php?name=$1
RewriteRule ^(.*)/$ cat.php?name=$1

The URI will be somthing like this:
www.domain.com/category-name/
www.domain.com/post/hello-world

as you see, in the end of the first address (category) there is a '/' and on the second there isn't '/', how can I do it too on the second address? if I will do somthing like this:
RewriteRule ^post/(.*)/$ post.php?name=$1

it won't work because the server 'thinks' that I mean to category address.
hope you understand thank you.

A:

Use the [L] modifier on every rule so it stops processing further rules when a rule matched. In this case you can even make the trailing slash optional!
RewriteRule ^post/(.*)$ post.php?name=$1 [L]
RewriteRule ^(.*)/?$ cat.php?name=$1 [L]

