htaccess - force trailing slash?

Discussion in 'Apache' started by Kerosene, Jan 9, 2012.

  1. #1
    Can somebody please help me force a trailing slash on all my urls?

    domain.com/something-here
    >>
    domain.com/something-here/

    Here's my htaccess file:
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteCond %{SCRIPT_FILENAME} !-d 
    RewriteRule ^([^/.]+)/?$ index.php?i=$1 [QSA,L]
    
    Code (markup):
     
    Kerosene, Jan 9, 2012 IP
  2. blacknet

    blacknet Active Member

    Messages:
    709
    Likes Received:
    16
    Best Answers:
    2
    Trophy Points:
    70
    #2
    I'd strongly advise against doing this, it's going to cause 2 requests for every single request, and has no benefit at all. URIs are opaque, the presence of a trailing slash means nothing.
     
    blacknet, Jan 19, 2012 IP