I need to somehow remove the last slash in my directory URLs. For example, instead of example.com/projects/
, I'd like to see example.com/projects
. I have been trying many solutions with no luck so far. Here is my .htaccess
file currently:
Options +FollowSymLinks
DirectoryIndex index.html
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} /index\.html [NC]
RewriteRule ^(.*?)index\.html$ /$1 [L,R=301,NC,NE]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1/index\.html -f [NC]
RewriteRule ^(.+?)/?$ /$1/index.html [L]
ErrorDocument 404 http://www.example.com/error404.html
/projects
a physical directory on the filesystem? Do you only want to remove the trailing slash when the URL does map to a physical directory?/projects
is a folder in the root. This folder contains an index.html file which displays when the folder is linked to like this: "olivar.info/projects". I intend on having the index appear as "olivar.info/projects" and other pages within the projects file like "olivar.info/projects/exampleproject".