Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for step by step resource about how to rewrite URLs and have a few specific questions.

I've read the documentation on mod_rewrite in Apache, but I still find myself a little lost.

  1. If I have example.com/products.html, can I change this to appear as example.com/products? For that to happen, do I make all of my links point to /products and then have a rewrite rule that directs /products to /products.html? Or is it the other way around?

  2. Also, for PHP forms, I've noticed that I can't have a form action that points to a directory: for example, it requires /mail/index.php instead of just /mail.

Can mod_rewrite fix this too?

share|improve this question
Yes, mod_rewrite can do both things. Relevant: Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask? – Pekka 웃 Nov 20 '11 at 10:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.