I'm using a Red Hat Apache web server (2.4.6). The Apache is adding "/" at the end of URL if directories are accessed (default behaviour) through http 301. I want to avoid http 301 by the Apache web server while accessing directories. So I have done this.
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
DirectorySlash Off
</Directory>
I noticed DirectorSlash Off stopped Apache from automatically adding "/" to directories in the URL.
I added the below at the end of httpd.conf but it has no effect. I don't see the below is adding "/" to the directory in the URL. The Rewrite rules are not firing. Any idea what's wrong.
RewriteEngine on
RewriteCond %{REQUEST_URI} !(.+)/$
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+)$ $1/ [P]
Thanks in advance.