Blogger Friendly Urls ?

Discussion in 'PHP' started by piniyini, Jan 22, 2005.

  1. #1
    Hi guys, I was wondering if you could help me out on something that I have wanted to do for ages with my blog; friendly extensionless urls.

    My blog is at run by blogger and as a result I cant control much of the html generated. Thanks to shawns post over at http://www.digitalpoint.com/~shawn/2004/11/how-to-hide-deleted-comments-in.html its given me an idea.

    By altering his script below:
    
    <?php 
        $file = file_get_contents ($_REQUEST['file']); 
        $a = substr_count ($file, 'deleted-comment'); 
        $b = preg_match ('/<h4>(.*?) Comments:<\/h4>/i', $file, $matches); 
         
        echo str_replace ('<h4>' . $matches[1] . ' Comments:</h4>', '<h4>' . ($matches[1] - $a) . ' Comments:</h4>', $file); 
    ?>
    
    PHP:
    it can be possible to match the url in the format http://www.toseef.com/2004/11/cronjob-database-backup-script.html and replace it with http://www.toseef.com/200411-cronjob-database-backup-script

    As I dont know php to a high level can anyone tell me how to go about it?
     
    piniyini, Jan 22, 2005 IP
  2. bigdork

    bigdork Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This sounds like somethink .htaccess Apache mod_rewrite would be good for ..

    i will paste the urls here.. but i am not allowed to link them yet, sorry :)

    replace the 'xx' with 'tt'

    hxxp://www.sitepoint.com/article/guide-url-rewriting

    hxxp://www.modrewrite.com

    hope that points you in the right direction ..
     
    bigdork, Mar 28, 2008 IP