WordPress.org

Ready to get started?Download WordPress

Forums

Extending rewrite rules (1 post)

  1. sccr410
    Member
    Posted 3 years ago #

    I am trying to extend the rewrite rules for a directory.

    I am setting up 50 pages, 1 for each state. The default rewrite rules handle these pages.

    EX: http://www.domain.com/directory/california

    However, I want to extend URLs to also include one more level of detail - cities.

    EX: http://www.domain.com/directory/california/san-diego

    However, doing this returns a 404 because there is no page created for San Diego. I don't want to create pages for San Diego. I essentially want this:

    http://www.domain.com/directory/california/san-diego

    rewrites to

    http://www.domain.com/directory/california?city=san-diego

    I will use template logic to then determine if a city is defined - if so, show all listings within the city. If no city is defined, show all the available cities for the current state.

Topic Closed

This topic has been closed to new replies.

About this Topic