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:

http://www.generateit.net/mod-rewrite/

Cool tool to generate mod rewrite rules!

Test your RewriteRules for Apache mod_rewrite

2nd. Test your RewriteRules for Apache mod_rewritehttp://martinmelin.se/rewrite-rule-tester/

 

4th. Cool question and answer from stack overflow (not the top answer, but it worked better for me than the top answer)

([A-Za-z0-9-]+)

…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:

([A-Za-z0-9_-]+)

Source: http://stackoverflow.com/questions/2338044/regex-letters-numbers-dashes-and-underscores

[end]

Hopefully if you’re working with mod_rewrite rules and regex these links can help you too!

Leave a Reply

Your email address will not be published. Required fields are marked *