• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

?id= URL's are no,no's

Status
Not open for further replies.
1,673
Posts
18
Years
    • Seen Apr 19, 2020
    I've noticed most of us use the type of PHP includes where we have to type our urls like this:

    https://www.sitename.com/index.php?id=page
    https://www.sitename.com/?id=page
    https://www.sitename.com/?page=page

    I'm going to suggest you,DON'T use those type of URL's. If you're using PHP includes,stick this into a .htaccess file

    Code:
    RewriteEngine On
    RewriteRule ^id/(.*)$ /?id=$1

    Don't edit that code unless you're familiar with regex or rewrite rules. Only edit it to replace the "id" expression in it.

    Where you see an "id" expression,you replace that with what you're using (page,px,etc.).

    For example,if I were using an ?id=page url,then I would type it like this:

    https://www.sitename.com/id/pagename

    And it's all good. Remember that search engines don't index pages that have a ? in them.

    Just a little of my heads up posts. If you have another way of using it,post here.

    Enjoy,Faltzer
     

    aRedMoon

    Wait for me outside the lines
    11,127
    Posts
    20
    Years
  • That's only if you care about SEO. I personally don't, and find the ? URLs much nicer.

    And then you can do stuff like ?page=pott&action=random
     
    1,673
    Posts
    18
    Years
    • Seen Apr 19, 2020
    I'm not impressed by seeing ?page=pott&action=ranom in a URL. And I personally care about SEO because I don't really recieve that much hits a day. About 50-60,and I don't approve people dissing mod_rewrite. It owns ?id= URL's and others. People don't really understand why ?id= urls are terrible. Most new people to the internet know nothing about ?id= URL's that most people are now using,and mod_rewrite's main purpose is to have much prettier URL's.
     

    aRedMoon

    Wait for me outside the lines
    11,127
    Posts
    20
    Years
  • With mod_rewrite, coding things like ?page=pott&action=random gets a bit more challenging.

    Have you ever coded something like that? I'll give you a peek at my PotT script.
    PHP:
    <?
    
    /*
    
    Title: Picture of the Timeframe
    Last Edited: July 29, 2006
    Author: JKaizer
    
    Do I need some sort of license?? Oo;;;
    
    CHANGE LOG
    Jul29: Added the slideshow feature
    Apr10: Oooh, a random picture now :D
    Apr8: Start of change log. Added comments throughout the code to make it a tad easier to navigate.
    
    */
    
    // We need variables before we do anything
    $id = $_GET['id']; // The picture ID, if we're doing the archive
    $action = $_GET['action']; // If we're not just viewing a "chosen" picture, we can use this.
    $prevpott = $id - 1;
    $nextpott = $id + 1;
    
    //
    // The Archive
    //
    if ($action == old) { 
    print "<h2><div align=\"left\" style=\"float: center; padding: 2px;\"><b>Picture of the Timeframe Archive</b></div></h2>";
    print "<div style=\"float: center; padding: 2px;\">";
    
    print "<div align=\"center\">";
    
    $times = $pott;
    $x = 001;
    while ($x <= $times) {
    if ($x < 10) { echo "<a href=\"?page=pott&id=00$x\"><img src=\"images/pott/00$x.sm\" style=\"border: 0px solid #000000; padding: 2px;\" alt=\"Mini PotT\" /></a>"; }
    else if ($x > 9 && $x < 100) { echo "<a href=\"?page=pott&id=0$x\"><img src=\"images/pott/0$x.sm\" style=\"border: 0px solid #000000; padding: 2px;\" alt=\"Mini PotT\" /></a>"; }
    else { echo "<a href=\"?page=pott&id=$x\"><img src=\"images/pott/$x.sm\" style=\"border: 0px solid #000000; padding: 2px;\" alt=\"Mini PotT\" /></a>"; }
    ++$x;
    } 
    
    print "</div>";
    }
    //
    // End The Archive
    //
    
    
    //
    // Start Slideshow
    //
    
    if ($action == slideshow) { 
    print "<h2><div align=\"left\" style=\"float: center; padding: 2px;\"><b>Picture of the Timeframe Slideshow</b></div></h2>";
    print "<div style=\"float: center; padding: 2px;\">";
    
    if (!$id) { print "You need to chose a picture silly! Go to the <a href=\"?page=pott&action=old\">archive</a> and choose one!"; }
    
    else {
    print "<div align=\"center\">";
    print "<img src=\"images/pott/$id.jpg\" alt=\"Current\" /><br /><br />"; // The current picture
    
    // Previous
    if ($prevpott == 0) { print ""; }
    else if ($prevpott < 10) { print "<div style=\"float: left; padding-left: 50px;\"><a href=\"?page=pott&action=slideshow&id=00$prevpott\"><img src=\"images/pott/00$prevpott.sm\" style=\"border: 0px solid #000000; alt=\"Previous\" /><br />Previous</a></div>"; }
    else if ($prevpott > 9 && $prevpott < 100) { print "<div style=\"float: left; padding-left: 50px;\"><a href=\"?page=pott&action=slideshow&id=0$prevpott\"><img src=\"images/pott/0$prevpott.sm\" style=\"border: 0px solid #000000; alt=\"Previous\" /><br />Previous</a></div>"; }
    else { print "<div style=\"float: left; padding-left: 50px;\"><a href=\"?page=pott&action=slideshow&id=$prevpott\"><img src=\"images/pott/$prevpott.sm\" style=\"border: 0px solid #000000; alt=\"Previous\" /><br />Previous</a></div>"; }
    
    // Next
    if ($nextpott == $pott + 1) { print ""; }
    else if ($nextpott < 10) { print "<div style=\"padding-right: 50px; float: right;\"><a href=\"?page=pott&action=slideshow&id=00$nextpott\"><img src=\"images/pott/00$nextpott.sm\" style=\"border: 0px solid #000000; alt=\"Next\" /><br />Next</a></div>"; }
    else if ($nextpott > 9 && $nextpott < 100) { print "<div style=\"padding-right: 50px; float: right;\"><a href=\"?page=pott&action=slideshow&id=0$nextpott\"><img src=\"images/pott/0$nextpott.sm\" style=\"border: 0px solid #000000; alt=\"Next\" /><br />Next</a></div>"; }
    else { print "<div style=\"padding-right: 50px; float: right;\"><a href=\"?page=pott&action=slideshow&id=$nextpott\"><img src=\"images/pott/$nextpott.sm\" style=\"border: 0px solid #000000; alt=\"Next\" /><br />Next</a></div>"; }
    }
    
    }
    //
    // End Slideshow
    //
    
    
    
    //
    // Random Picture~
    //
    else if ($action == random) { 
    echo "<h2><div align=\"left\" style=\"float: center; padding: 2px;\"><b>Random PotT!</b></div></h2>";
    echo "<div style=\"float: center; padding: 2px;\">";
    echo "Because we all like to be random!";
    echo "<br /><br />";
    
    echo "<div align=\"center\">";
    
     $randompic = rand(1,$pott);
        if ($randompic < 10) { echo "<img src=\"images/pott/00$randompic.jpg\" style=\"border: 0px solid #000000; padding: 2px;\" alt=\"Random Pic!\" />"; }
        else if ($randompic > 9 && $randompic < 100) { echo "<img src=\"images/pott/0$randompic.jpg\" style=\"border: 0px solid #000000; padding: 2px;\" alt=\"Random Pic!\" />"; }
        else { echo "<img src=\"images/pott/$randompic.jpg\" style=\"border: 0px solid #000000; padding: 2px;\" alt=\"Random Pic!\" />"; }
    
    print "</div>";
    }
    //
    // End Random Picture
    //
    
    
    
    //
    // And if we aren't in the pretty gallery, or in a slideshow, or doing the random picture...
    // let's just post the PotT! :D
    //
    else {
    echo "<h2><div align=\"left\" style=\"float: center; padding: 2px;\"><b>Picture of the Timeframe";
    
    // Check to see if it's an old picture - if it is, add " Archive" after it
    if (!$id) { echo ""; }
    else { echo " Archive"; }
    // End check
    
    echo "</b></div></h2>";
    echo "<div style=\"float: center; padding: 2px;\">";
    
    // Old or new pic? We have different phrases for that
    if (!$id) { echo "Randomly updated with a new picture every now and then :D"; }
    else { echo "This is the archive of the PotT. You're looking at picture number $id :D<br /><br />Wanna start a slideshow? Then <a href=\"?page=pott&action=slideshow&id=$id\">click here</a>!"; } // oh, connecting the slideshow up!
    // End
    
    echo "<br /><br />";
    
    echo "<div align=\"center\">";
    
    $folder = "images/pott/";
    $ext = ".jpg";
    $main = "images/pott/$pott.jpg"; // if we don't have $id set
    
    $page = "$folder" . $_GET['id']; // find out what image we're dealing with here
    $newpage = $page . $ext;
    if(!isset($_GET['id'])){
    print "<img src=\"$main\" alt=\"PotT\" />"; // do this if we don't have $id set
    }
    else {
    print "<img src=\"$newpage\" alt=\"PotT\" />"; // and if we do :D
    }
    
    echo "</div>";
    }
    ?>
     
    1,673
    Posts
    18
    Years
    • Seen Apr 19, 2020
    And you actually code your site like that? Koroku has a hard life. ._. I've tried coding those URL's and I recieve internal server errors all the time. And why in the world do you HAVE to have those type of URL's?
     

    aRedMoon

    Wait for me outside the lines
    11,127
    Posts
    20
    Years
  • How odd, the
    PHP:
     tag no longer works.
    
    It's a nice script, because to update it, all I have to do is this:
    
    (xxx = image number)
    
    Make xxx.jpg and xxx.sm, put them in /images/pott/
    
    Then I change $pott in index.php to xxx and presto, my gallery is updated, the slideshow is updated, it shows a new pic on the sidebar.
    
    It's amazing.
     
    1,673
    Posts
    18
    Years
    • Seen Apr 19, 2020
    The PHP tag doesn't work anymore,probably because they disabled it. I also don't get that code one bit. And do your page url's have to be ?page=pott&action=random for that code to work? While I'm still learning some regex,I might make mod_rewrite work like this:

    https://www.site.com/pagename/
    https://www.site.com/folder/page

    I've been wanting to do it like smogon has,but failed...
     

    aRedMoon

    Wait for me outside the lines
    11,127
    Posts
    20
    Years
  • I'm sure you could do something like

    /page/pott/action/random

    But that looks stupid, and doesn't show the correlation. Now to mention that people could do

    /page/pott/action/

    And what would they get? (I'm not sure actually oO)
    I also don't get that code one bit.
    It's kinda complicated, and a lot more than I need (as JA so nicely told me last night) but I've done comments throughout and so it shouldn't be too hard to figure out, if you have any PHP knowledge.
     
    1,673
    Posts
    18
    Years
    • Seen Apr 19, 2020
    I've started researching PHP,and I'm not too familiar with variables in PHP yet,I'm pretty new to mod_rewrite,but soon,I'll make urls look like normal plain URL's,so people won't even notice you're using the PHP include script.
     
    1,673
    Posts
    18
    Years
    • Seen Apr 19, 2020
    Are you sure you're in the right topic? I didn't get that post one bit. o.O
     

    Drifblim

    Banned
    1,773
    Posts
    18
    Years
  • I know what I'm talking about, thank you.

    I thought you'd realise that by looking at some of the URLs on the site you'd judge that getting rid of question mards and fields in the URL makes for a messy and unintelligible URL.
     
    1,673
    Posts
    18
    Years
    • Seen Apr 19, 2020
    If you would understand mod_rewrite as most people do,you can have prettier URL's and much better then ?id= ones.
     

    Geometric-sama

    The Manly Man of Steel
    11,440
    Posts
    20
    Years
  • Keep in mind that you can define multiple rewrites, and if you use a [L] it won't redirect any further, so you can have pages drop through like a sieve. This allows you to use the SEO URLs for most pages, and then for pages that take extra variables (like Greg's) you can simply disable the redirection.
     

    ~Johnny

    Monkey
    3
    Posts
    17
    Years
  • [AGELIMIT][/AGELIMIT]
    Rodaru said:
    And it's all good. Remember that search engines don't index pages that have a ? in them.

    Just like to point out that search engines do index pages with "?" in them.

    And personally, I prefer seeing "?id=", and it just makes more sense to me. Using "/" all the time would confuse me with directories, and visitors coming along.
     
    1,673
    Posts
    18
    Years
    • Seen Apr 19, 2020
    Well if it isn't the Pokecollege admin. Even if they do index url's with a "?" in them,robots can't fully index the pages,and can sometimes be caught in a loop,causing robots to avoid the indexing of pages.
     
    1,361
    Posts
    20
    Years
    • Age 38
    • Seen Sep 27, 2009
    If you dont care about SEO and some peop-le said, then you dont care about your sites future and it will NEVER go anywhere you want it to go. Each page should have its own pagename.php, with keywords in it. Say you want an url for your pokemon games section, dont put "games.php" make it "Pokemon-Games.php"

    Google will only index 2 of your pages with the index?id= style..
    you will have yourdomain.com and yourdomain.com/index.php

    Instead of having 50+ pages listed in google you now have 2.
     
    Status
    Not open for further replies.
    Back
    Top