Welcome to the Treehouse Community
Looking to learn something new?
How to write a rewrite rule with a string as the key?
I currently have an array of projects and for the key of each project I am using the project name instead of a number like 101. In the rewrite rule tutorials Randy only shows how to do this using numbers. What regular expression could I use to solve this?
Thanks in advance.
Chris Shaw26,650 Points
The most generic expression you can use is
([\w-_]+) which will make all characters in both upper and lowercase and allow hyphens and underscores if you need them, if you can let us know an example URL we can give you a more precise expression.
Ok cool, thanks Chris, I will give this a try! I am still working from my local server so it would be something like:
What I want is: