Remove Trailing Slash From Root WP Directory
I have WP installed in a directory above the domain ( example https://example.com/folder/ )
I want the WP index page to get accessed without the trailing slash ( example https://example.com/folder ).
WP by default is doing a 301 redirect to https://example.com/folder/
I have tried the following with no resolution:
1) Set the Permalinks setting to: /%postname% My canonical is correct and showing https://example.com/folder but it is still 301 redirecting to https://example.com/folder/
2) Edited the .htaccess file to:
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)/$ /$1 [L,R]
3) Removed the redirect_canonical() filter from functions.php:
add_filter('template_redirect', 'redirect_canonical');
Leave an answer