1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

SEF URLs for portable script

Discussion in 'PHP' started by Gmorkster, Sep 14, 2005.

  1. #1
    We're developing a blogging script that should allow users to optionally switch to SEF URL's. The script should run on as many platforms as possible, which means it might not be run on an Apache server or mod_rewrite might not be present.

    The URL's needed are only a few, something in the line of

    /article.php?blogID=123&articleID=2455
    /album.php?blogID=123&albumID=4325&folderID=234&resID=2435
    /links.php?blogID=235&catID=23453&linkID=3453

    There are a few more in an admin section but SEFing those URL's is not a priority as they won't get spidered (duh!).

    Should we bother to check if the server is Apache and mod_rewrite is enabled, in order to use .htaccess or is it enough to use URLs like /article.php/blogID/123/articleID/24554, that work on any platform? Sounds like a bit of extra work, since we could deliver the script with SEF links out of the box using the latter example. Is there a real advantage of using mod_rewrite for the above URLs over playing around with $_GETs?

    Second question: if we should use mod_rewrite wherever possible, what's a good way of checking for the existence of Apache and mod_rewrite? I was thinking of having the install script attempt to redirect /foo/123 to /bar.php?123 and check for 404, but that's a bit sloppy. The script needs to be user friendly, so the way Wordpress handles this issue (it says somewhere that if your links get porked after changing the Permalink pattern you should remove the .htaccess and start over-- that's way too much overkill for a non-techie user)
     
    Gmorkster, Sep 14, 2005 IP
  2. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I have yet to see evidence that passing parameters in a URL is not SEF. :)

    And as for your second question. Make an http request to the server, and check the headers to see what server software it professes to run. In your .htaccess file you can check if mod_rewrite is on
     
    exam, Sep 15, 2005 IP
  3. Gmorkster

    Gmorkster Peon

    Messages:
    202
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Question was if there's any added value of mod_rewrite over whatever the latter example is called...
     
    Gmorkster, Sep 17, 2005 IP
  4. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Well yes, in that with mod_rewrite you can't tell that they're dynamic pages, as far as search engine friendlyness, it's a toss up. Some people will tell you mod_rewrite is better, but I think with the second solution, the SE's will index stuff fine, but maybe your customers will think it's not as good.
     
    exam, Sep 17, 2005 IP
  5. Willy

    Willy Peon

    Messages:
    281
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I'd agree with exam's latter point: I'd do SEF URLs if simply for no other reason than that they look a lot better to the visitors of your site.

    In this day and age, search engines have to attempt to index dynamic URLs (otherwise treasure troves like DP wouldn't be indexed at all). But, in this day and age, there's also no valid reason not to provide readable and friendly URLs to both your visitors and the search engines, except ignorance and laziness (not accusing you, you're here asking after all ;))

    There's a lot of unnecessary confusion about SEs and dynamic URLs, though. Let's review the backstory briefly: "back in the day", most search engines refused to index anything that had a query string (e.g. "?id=123") in the URL. This had to do both with the fact that the web was then considerably more static than today, as well as the fact that correctly indexing dynamic pages can be quite an engineering challenge (I've written a web crawler myself, once upon a time) due to badly designed systems that will even give out infinite variations of new URLs if the crawler isn't designed to specifically detect that. So that's where this whole issue stems from, and why many people who haven't followed the developments in this area still might erroneously think dynamic pages won't get indexed at all.

    Nowadays, Google and other SEs will index most dynamic pages, but they still prefer static pages (or static-appearing pages, such as achieved with mod_rewrite). Straight from the horse's mouth:

    And there are a few more relevant remarks in Google's webmaster guidelines as well:

    Now, that pretty much sums it up, don't you think? ;) The only point that's missing is that while your dynamic page might indeed get indexed, that doesn't mean it would rank as well as if it were done using a static URL. The reason for that is simple enough: for better or worse, search engines assign a lot of weight to keywords found in the URL, and for dynamic pages, the only keywords search engines are going to find there will be the domain and directory names.

    Of course, this reasoning only applies when using numeric identifiers in the URL (/article.php?articleID=2455). If you implement a dynamic URL scheme but do lookups using string titles and values (/article.php?articleTitle=XXX) then the advantage is less clear; but then mod_rewriting the entire thing also becomes trivial ;)

    All the above notwithstanding, to reiterate: I at least am such an anal-retentive perfectionist that I could not possibly keep from designing SEO URLs into a site or system if it was in my power to do so, whether it would make any difference in the SERPs or not :D
     
    Willy, Sep 17, 2005 IP
    Gmorkster likes this.
  6. king_cobra

    king_cobra Peon

    Messages:
    373
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #6
    All this buzz about SEF frienly URLs has no basis as far as google is concerned. If you can limit the number of passing parameters to 2 then there shd not be any advantage using page?varr=1&var=2 and page/1/2/. But ofcourse if the keyword is in the URL then that is an advantage. So u shd concentrate on having for example blogname instead of blogid in the url.
     
    king_cobra, Sep 18, 2005 IP
  7. Gmorkster

    Gmorkster Peon

    Messages:
    202
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thanks for all the comments!

    Edited: off topic: I'm not getting email notifications on this thread, even though I'm subscribed, what the heck's wrong?
     
    Gmorkster, Sep 18, 2005 IP