0

I have marked my Previous Question as duplicate But I am getting Problem after testing the existing solutions ..I am posting what I have tried further ..

I am trying to remove trailing slash in every incoming request URL

I Searched and studied other posts including this

Htaccess: add/remove trailing slash from URL

and Based on existing Answers I Wrote htaccess

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

this rewrites my URL from

http://localhost/WCOM/Flatsome/blog/

to

http://localhost/blog

I Tried another htaccess

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]

This rewrites URL

from

http://localhost/WCOM/Flatsome/blog/

to

http://localhost/WCOM/Flatsome/blog.htm

I am much satisfied with later htaccess code But I want to remove extension keeping removed slash .. How can it be done ??

Community
  • 1
  • 1
Neeraj Verma
  • 2,174
  • 6
  • 30
  • 51

1 Answers1

0

this worked for me

#Fix Rewrite
Options -Multiviews

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) /$1.htm [L]
Neeraj Verma
  • 2,174
  • 6
  • 30
  • 51
  • Your answer has this rule "RewriteRule ^(.*)/$ $1 [L,R=301]" .. it was not working for me ... Ineed to change it to "RewriteRule (.*) /$1.htm [L]" – Neeraj Verma Dec 17 '15 at 15:31
  • this rule is removing / from My URL ... resulting URL I am getting is " http://localhost/WCOM/Flatsome/blog " – Neeraj Verma Dec 17 '15 at 15:39