Created
April 26, 2023 12:17
-
-
Save gmmedia/1c684cf78c079bba486817e950df141f to your computer and use it in GitHub Desktop.
WordPress: Force add trailing slash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Force trailing slash | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_METHOD} GET | |
RewriteCond %{REQUEST_URI} !(.*)/$ | |
RewriteCond %{REQUEST_URI} !^/wp-json/ | |
RewriteCond %{REQUEST_URI} !^/gravatars/ | |
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpg|png|jpeg|css|xml|txt|js|php|scss|webp|mp3|avi|wav|mp4|mov|pdf|html|htm|xst)$ [NC] | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1/ [L,R=301] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment