WordPress.org

Ready to get started?Download WordPress

Forums

OT: How to create search engine friendly urls like wordpress (3 posts)

  1. bootsmaat
    Member
    Posted 5 years ago #

    Hey there!

    This question is not exactly about the usage of wordpress but rather about something that wordpress does and which totally fascinates my: it rewrites urls the way that it contains the post or page title.

    and I want to know how to do this. Not for my wordpress installation (it works perfectly there) but for a different project I'm working on.

    I know about the apache module mod_rewrite and its amazing capabilities. I've read articles like this one and I understand how it works. They explain how to turn an url like ...index.php?product=12&companyID=345 into something like .../apple/ipod/

    But none of the articles I've found explain how I can use this technique to do what wordpress does: use a seemingly random string like "this-is-my-blog-post" to retrieve exactly this blog post.

    Does anyone here have more insight into wordpress' url rewriting technique than I do? I'd be interested in because I'd love to apply this technique to my other project.

    Thank you!

  2. MichaelH
    Member
    Posted 5 years ago #

  3. Ivovic
    Member
    Posted 5 years ago #

    well, if you're comfortable with your understanding of the rewriting part, then it's important to note that the rewriting is being sent to the same file (index.php)

    wordpress then takes your URL and breaks it up according to your permalink options. First you tell it what the /x/y/z/ mean in the permalink settings, right? then it uses that information to deduce which of those is a category, and which is a page or a post name.

    using the most common settings as an example...

    if it finds /category/x/ it knows, that x is a category, if it finds just /x/ then it's a page... since /9999/ is a number and if your permalinks are date based, then it's most likely a yearly archive, right?... and so on.

Topic Closed

This topic has been closed to new replies.

About this Topic