I have been trying to get this to work on my client's server for a website I am developing, but I simply cannot get it to work. Basically I am trying to remove the .html extensions, and add a trailing slash (in the URL bar). So if someone enters: [TABLE="class: grid, width: 700, align: left"] [TR] [TD]example.com/home/[/TD] [TD]goes to[/TD] [TD]example.com/home/[/TD] [/TR] [TR] [TD]example.com/home[/TD] [TD]goes to[/TD] [TD]example.com/home/[/TD] [/TR] [TR] [TD]example.com/home.html[/TD] [TD]goes to[/TD] [TD]example.com/home/[/TD] [/TR] [TR] [TD]example.com/home.html/[/TD] [TD]goes to[/TD] [TD]example.com/home/[/TD] [/TR] [/TABLE] Here is my .htaccess so far, which works PERFECTLY, and does everything I want it do, except add the trailing slash at the end. Here is that code: #force www RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] # remove .html ONLY if requested directly RewriteCond %{THE_REQUEST} (\.html\sHTTP/1) RewriteRule ^(.+)\.html$ /$1 [R=301,L,QSA] # remove trailing slash ONLY if it is not an existing folder RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [L,R=301] # rewrite to FILENAME.html if such file does exist and is not a folder RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(.*)$ /$1.html [L,QSA] Code (markup): All of my files hosted on the server are in the form of FILENAME.html, and are located in the root directory. So, if any one could please help me out, I would really appreciate it.
Sorry I can't help you. But you seem to know quite a bit about mod_rewrite. Can you have a look at my issue and see what you think? http://forums.digitalpoint.com/showthread.php?t=2449168