0

I'm rewriting url using htaccess.
Here is my .htaccess file

Options -Indexes
RewriteEngine on

RewriteRule (.*)/$ post.php?&url=$1

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) $1.php [L]

I want to remove slash from the end of the url.
For example :

https://www.example.com/some-post/

to

https://www.example.com/some-post

PS. Not From index.php but a different page.

Alex
  • 1,451
  • 5
  • 15
  • 16

1 Answers1

1

To force a redirect from URLs ending in / to the same URL without the slash just do:

RewriteRule ^(.+)/$ $1 [L,R=301,QSA]
Bananaapple
  • 2,984
  • 2
  • 25
  • 38