Skip to content

Instantly share code, notes, and snippets.

@codesharpdev
Forked from jiceb/.htaccess
Created November 22, 2022 17:24
Show Gist options
  • Save codesharpdev/5834e2f5968c133bc3d9fa78cebf1854 to your computer and use it in GitHub Desktop.
Save codesharpdev/5834e2f5968c133bc3d9fa78cebf1854 to your computer and use it in GitHub Desktop.
Remove trailing slash with .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# where the magic is done !
RewriteRule (.*)/$ $1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment