Need Help with an .htaccess file

Discussion in 'Apache' started by neil patrick harris, Aug 14, 2008.

  1. #1
    I managed to find this for removing .htm or .html from my urls so they just have a trailing slash at the end.

    But how do I make it work for non index.html files? for example my main index file in one folder is named web.htm I know the easy solution is to name it index.htm but I'm worried about accidently copying over my homepage at some point.

    heres the .htaccess file which works fine for my flsh/index.html

    RewriteEngine on
    RewriteBase /
    #
    ## Internally rewrite extensionless /flsh URLs to existing .html files
    # If no filetype extension on requested URL
    RewriteCond %{REQUEST_URI} !\.[a-z0-9]+$
    # If URL plus extension exists as a file
    RewriteCond %{REQUEST_FILENAME}.html -f
    # Internally rewrite to file with extension
    RewriteRule ^flsh/(.*)$ /flsh/$1.html [L]
    #
    ## Externally redirect old .html-extension /info URLs to new extensionless URLs
    # If direct client request for .html files
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /[^.]+\.html\ HTTP/
    # Externally redirect to URL without extension
    RewriteRule ^info/([^.]+)\.html$ http://www.plentyoftorrents.com/flsh/$1 [R=301,L]

    I would like http://www.plentyoftorrents.com/web/web.htm
    to be http://www.plentyoftorrents.com/web/
     
    neil patrick harris, Aug 14, 2008 IP