0

How can I make it so when a user uses a trailing slash, for example this link:

website.com/staff/ 

It will redirect to a 404 not found page?

Amit Verma
  • 40,709
  • 21
  • 93
  • 115
bbcode
  • 37
  • 6

1 Answers1

0
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /$ - [R=404,L]

This will return a 404 not found error for all requests (except directories) if they contain a trailing slash.

Amit Verma
  • 40,709
  • 21
  • 93
  • 115