• I see that you can make links cleaner when they are in the format of “/?p=xxx”. My question is, can you make links cleaner if they are coded to have a different URL format than wordpress gives you? I have link formats such as “/?page_id=xxx&gameId=xx” because I have a gaming site and my friend made a few pages that connected to a database we made and we added the ‘&gameId=xx’ part to the url. Is there a way I can make this extensions to the url clean? Like have it go from “/?p=xxx&gameId=xx” to being “category/post-name/gamename”.

Viewing 5 replies - 1 through 5 (of 5 total)
  • In Settings permalinks select custom structure and in box add
    /%postname%/

    if you want add category as then
    /%category%/%postname%/

    You can more information here

    http://codex.wordpress.org/Using_Permalinks

    Adding /%category%/%postname%/ to “Settings/Permalinks” Custom Structure will give you a URL like

    http://yoursite.com/category/postname

    , but I’m not sure how you would add the last bit for the /gameID

    Thread Starter Zardon

    (@zardon)

    @fishdogfish – Yea, that’s exactly what I am trying to find out. My .htaccess file has only 3 lines in it which confuses me because it should have a lot of rewrite rules in it. It looks like this:

    php_value memory_limit 256M
    # BEGIN WordPress
    
    # END WordPress

    So I don’t know where to add or edit the rules at. Don’t know what files permalinks has access to.

    You probably don’t have any Custom Structures set, so wp uses the default and doesn’t add anything to .htaccess

    How were you getting the gameId from the database before? You might be able to use that method then append it to the URL.

    Or you could simply change the post SLUG to include the gameID

    Example: Post Title:How To Play Modern Warfare 2
    SLUG: how-to-play-modern-warfare-2

    If you include it in the title the first time you publish the post, the slug will match the title.

    If you want a title that doesn’t include the game id, then you can just edit the SLUG later to add the gameID to the URL.

    With that in mind…

    There’s probably another way, by adding a custom field with the gameID in it as the key, and then appending that key to the URL using a php function, but I haven’t attempted it yet.

    Thread Starter Zardon

    (@zardon)

    My friend was the one who did the coding. He actually did it manually. He just added that bit of code to the url format so it would make the game url format looks more “individualized”.

    This is a piece of the code he made and one of the first instances you see the gameId code used:

    <td><a href=http://www.mmocraze.com/?page_id=222&gameId=" . $row['gameId'] . ">" . $row['gameName'] . "</a></td>" .
            "<td align=center>" . $row['gameType'] . "</td>" .
            "<td align=center>" . $row['gameGenre'] . "</td>" .
            "<td align=center>" . $row['gameCost'] . "</td>" .
            "<td align=center>" . $row['gameRating'] . "</td>" .
            "<td align=center>" . $row['gameCrazeLevel'] . "</td>" .
        "</tr>"

    So basically….that extra url extension forces the site to connect to the database and return the results it finds to the site and then creates a link for the game that is inside the database adding the ‘&gameId=’ part to the url format followed by the database results it finds (the ID for the game and whatnot).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Edit SEO settings for permalinks?’ is closed to new replies.