WordPress.org

Ready to get started?Download WordPress

Forums

Can Permalink be just /%postname% (9 posts)

  1. SEO Staff
    Member
    Posted 7 years ago #

    Hi I read somewhere that in earlier versions of wordpress setting custom permalink structure to /%postname% could generate some errors.

    Is it safe to have /%postname% (or /%postname/) as the custom permalink in WP 2.1 ?

  2. Pizdin Dim
    Member
    Posted 7 years ago #

    Yes, it is. Provided you don't have more than one post with the same slug.

  3. SEO Staff
    Member
    Posted 7 years ago #

    What happens if there is more than one post with same slug. Also can you point me to some article where its explained how wordpress generates permalinks.

  4. Pizdin Dim
    Member
    Posted 7 years ago #

    "What happens if there is more than one post with same slug"

    I don't know. I presume the only one of them will be selected. Why don't you actually try it and see for yourself?

  5. Aleister
    Member
    Posted 7 years ago #

    The good news is that WordPress will not automatically generate a slug that already exists. The only problem would be if you manually specified the slug name to be the same on two posts.

    If you create a post with the title 'test' the slug will be 'test'. If you create a second post with the same title, the slug will be 'test-2'

    As far as how WordPress creates the permalinks - do you mean how does it generate the slug? It basically just takes the post title, replaces spaces with dashes, removes non-standard characters (ones that are not valid in a URL), makes it lower-case, and sticks a number on the end if the same one already exists. Although there is probably a bit more to it, the is the overall idea I believe :)

    Now one thing you do have to watch out for I think is making sure the post slug is not the same as a page, but WordPress may automatically take care of this as well.

    Of course, there may be other concerns with having just /post-title/ as your permalink that I am not thinking of right now - it is late here ;)

  6. SEO Staff
    Member
    Posted 7 years ago #

    Thanks for all the help but I was wanting to look at the coding / technical aspect of permalink structure. I dont see anything being written in .htaccess file, so probably wordpress is using database to redirect url requests. If I know what its doing I might be able to find the answer for my question regarding validity, security and safety of using just /%postname% as custom permalink.

  7. Aleister
    Member
    Posted 7 years ago #

    Yes, the newer versions of WordPress store all rewrite rules internally. They just add a bit of code to .htaccess that allows them to work.

    If you are curious what rewrite rules WordPress is currently using, I have a plugin which generates a list of them:

    http://www.dagondesign.com/articles/wordpress-internal-rewrite-viewer-plugin/

  8. SEO Staff
    Member
    Posted 7 years ago #

    Thanks , but where does WP 2.1 store these rewrite rules ? In database ? or txt file ?

  9. Aleister
    Member
    Posted 7 years ago #

    In the database. I forget where exactly though. It has been a while since I looked. You could take a look at the source of that plugin of course.

Topic Closed

This topic has been closed to new replies.

About this Topic