mod_rewrite always baffles me… can anyone tell me the rules I need to get the following clean URLs? Desired URL on the left, real URL on the right.
/our-work/ => /our-work.html
/our-work/some-project/ => /our-work/some-project.html
/contact/ => /contact.html
As you can see, I want to force trailing slashes on all URLs too.
Thanks!
Try this rule:
And for adding trailing slashes:
Make sure to put those rules that cause an external redirect (explicitly using R flag or implicitly) in front of those rules that just cause an internal redirect/rewrite. So in this case: