0

I've been struggling trying to wrap my brain around this problem for a few hours. I'm basically trying to achieve this URL structure for a coupon site I run.

http://www.mysite.com/store/walmart/coupon-1

Each coupon is a WP post and the default structure for it now is.

http://www.mysite.com/coupon-1

The store text is static and if that was the only prefix I needed for a coupon I could easily go into Settings -> Permalink and setup something like this /store/%postname%/ but since the store name is dynamic ... well you see my problem.

I've started off approaching the problem by doing what I know and using a RewriteRule in .htaccess (ex: RewriteRule ^store/(.*)/(.*)$ $2 [R=301,L]) but that didn't give me the right result, it would just redirect to the original URL structure.

I've found a couple articles on the topic but they're either poorly explained or just refer to a simple redirect. Can anyone shed some light on this for me?

0

The simplest answer I can think of is to use what's already built in: categories.

If you know what stores you're going to have coupons for, create a category for each of them and assign that category to the post. You can then use a permalink structure like /store/%category%/%postname%.

  • Thats an excellent idea but its not going to work in my case unfortunately. I have a category section on the site that already uses that taxonomy so I have to leave categories alone. This might help someone else down the line though. – Ryan Grush Feb 11 '14 at 5:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.