About

J.D. has been a tech enthusiast since his dad let him play with computers in the early 80s. Now jdhodges.com is where he shares tips and news on a variety of topics. Thanks for visiting!

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!

You may be interested in:

Tagged with:  

Leave a Reply

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


3 × three =

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

84 queries in 0.381 seconds.