Great tools for understanding, writing and testing mod_rewrite rules
I have been writing some new mod_rewrite rules for my Pixensity website. The following tools and reference articles have been very helpful.
1st. Mod rewrite generator:
4th. Cool question and answer from stack overflow (not the top answer, but it worked better for me than the top answer)
…which matches letters and numbers. I would also like to match on dashes and underscores in the same expression. Anyone know how?
I would like to be able to match product_name and product-name
Your expression should already match dashes, because the final – will not be interpreted as a range operator (since the range has no end). To add underscores as well, try:
Hopefully if you’re working with mod_rewrite rules and regex these links can help you too!