How to remove trailing slash from URL in magento

Discussion in 'Programming' started by amber.long83, Jul 25, 2009.

  1. #1
    amber.long83, Jul 25, 2009 IP
  2. CRASS

    CRASS Active Member

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #2
    <?php
    $url = "http://www.websitename.com/index.php/";
    preg_match('/^http:(.*)\/$/i', $url, $matches);
    $whatever = substr($matches[0], 0, -1);
    echo $whatever;
    ?>
    PHP:
    This should do it.
     
    CRASS, Jul 25, 2009 IP
  3. szalinski

    szalinski Peon

    Messages:
    341
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    why would there even be a trailing slash in the first place?
     
    szalinski, Aug 12, 2009 IP