WordPress and ReWriteRule

I have a product-details template in my theme that handles display for different products based on the URL.

By default, WordPress will allow a number to be passed to the template page by appending to the URL: product-details/3/

However, I want to make this to be more SEO Friendly using a slug: product/sandals. Yet, when I do so, WordPress no longer finds the page by default.

I tried the following ReWriteRule with no luck.

RewriteRule ^product/([\w\-]+)/?$ product-details/?slug=$1 [L]

How can I have this custom slug sent to the template. I would prefer to keep everything in WordPress, but am willing to add the ReWriteRule.


Credit to Richard for answering this in the OP comments. I've highlighted the resource for completeness and to mark this question answered.


Need Your Help

Save textarea with Insert and then after Update

php jquery mysql html

Is there any way that I can make it so when someone clicks save on a textarea for the first time, it inserts it into the database and then anytime they click that save button after, it updates the ...

6 dimensional integral by Trapezoid in Fortran using Fortran 90

fortran fortran90 integral

I need to calculate six dimensional integrals using Trapezoid in Fortran 90 in an efficient way. Here is an example of what I need to do: