• 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 ?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Yes, it is. Provided you don’t have more than one post with the same slug.

    Thread Starter Manish

    (@nims)

    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.

    “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?

    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 ??

    Thread Starter Manish

    (@nims)

    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.

    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:

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

    Thread Starter Manish

    (@nims)

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

    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.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Can Permalink be just /%postname%’ is closed to new replies.