Hi,
I have to write a rewrite rule whereby if a url does not have a trailing slash I need to append the trailing slash.
For ex. should redirect to
I have this rewrite rule but this does not work
<code>
RewriteCond %{REQUEST_URI} /a/b
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ $1/ [L,R=301]
</code>
if I give the url it works I get the correct page
however
if I give the url
In the rewrite logs I see
<code>
RewriteCond: input='/a/b/c/index.shtml' pattern='/a/b' => matched
RewriteCond: input='/a/b/c/index.shtml' pattern='!-f' => matched
rewrite '/a/b/c/index.shtml' -> '/a/b/c/index.shtml/' => slash is appended at the end even though it is a file not a directory
</code>
Appreciate any help.
Thanks
I have to write a rewrite rule whereby if a url does not have a trailing slash I need to append the trailing slash.
For ex. should redirect to
I have this rewrite rule but this does not work
<code>
RewriteCond %{REQUEST_URI} /a/b
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ $1/ [L,R=301]
</code>
if I give the url it works I get the correct page
however
if I give the url
In the rewrite logs I see
<code>
RewriteCond: input='/a/b/c/index.shtml' pattern='/a/b' => matched
RewriteCond: input='/a/b/c/index.shtml' pattern='!-f' => matched
rewrite '/a/b/c/index.shtml' -> '/a/b/c/index.shtml/' => slash is appended at the end even though it is a file not a directory
</code>
Appreciate any help.
Thanks